Ejemplo n.º 1
0
    IEnumerator SpawnEnemy()
    {
        SCR_GamePlay game = SCR_GamePlay.Instance;

        while (true)
        {
            var   e = Instantiate(enemy);
            float x = Random.Range(-game.Width + 1, game.Width - 1);
            e.transform.position = new Vector2(x, game.Height + 1);
            yield return(new WaitForSeconds(delaySpawn));

            if (game.status != GameStatus.PLAY)
            {
                break;
            }
        }
    }