Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Emitter : MonoBehaviour {
- public GameObject[] waves;
- private int currentWave;
- // Use this for initialization
- /*
- IEnumerator Start ()
- {
- if(waves.Length == 0)
- {
- yield break;
- }
- while(true)
- {
- Debug.Log("コルーチン");
- GameObject wave = (GameObject)Instantiate(waves[currentWave],
- transform.position,
- Quaternion.identity);
- wave.transform.parent = transform;
- while(wave.transform.childCount != 0)
- {
- yield return new WaitForEndOfFrame();
- }
- Destroy(wave);
- if (waves.Length <= ++currentWave)
- {
- currentWave = 0;
- }
- }
- }
- */
- private IEnumerator e()
- {
- if (waves.Length == 0)
- {
- yield break;
- }
- while (true)
- {
- Debug.Log("コルーチン");
- GameObject wave = (GameObject)Instantiate(waves[currentWave],
- transform.position,
- Quaternion.identity);
- wave.transform.parent = transform;
- while (wave.transform.childCount != 0)
- {
- yield return new WaitForEndOfFrame();
- }
- Destroy(wave);
- if (waves.Length <= ++currentWave)
- {
- currentWave = 0;
- }
- }
- }
- private void Start()
- {
- StartCoroutine(e());
- }
- // Update is called once per frame
- void Update () {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement