Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Spawnabelha : MonoBehaviour {
- public GameObject abelha;
- public Vector3 spawnValues;
- public int abelhaCount;
- public float spawnWait;
- public float startWait;
- public float WaveWait;
- void Start()
- {
- StartCoroutine (SpawnWaves());
- }
- IEnumerator SpawnWaves ()
- {
- yield return new WaitForSeconds (startWait);
- while (true)
- {
- for(int i=0; i<abelhaCount; i++)
- {
- Vector3 spawnPosition = new Vector3 (spawnValues.x, Random.Range (-spawnValues.y, spawnValues.y), spawnValues.z);
- Quaternion spawnRotation = Quaternion.identity;
- Instantiate(abelha, spawnPosition,spawnRotation);
- yield return new WaitForSeconds (spawnWait);
- }
- yield return new WaitForSeconds(WaveWait);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement