Ejemplo n.º 1
0
    public IEnumerator round(int groups)
    {
        UnityEngine.Debug.Log("Round");
        for (int i = 0; i < groups;)
        {
            SpawnState.spawnRandom(100, 50, 2);

            yield return(new WaitForSeconds(1f));
        }
    }
Ejemplo n.º 2
0
    public IEnumerator roundController()
    {
        //IEnumerator localCoro;
        int roundNum = 1;

        foreach (int num in listRound)
        {
            //UnityEngine.Debug.Log("========================== NEW ROUND ================================");
            //UnityEngine.Debug.Log("Round Number: " + roundNum);
            //UnityEngine.Debug.Log("Groups: " + num);
            //UnityEngine.Debug.Log("=====================================================================");
            yield return(new WaitForSeconds(delayBetweenRounds));

            StartCoroutine(showMessage("Round " + roundNum, 3f));

            for (int i = 0; i < num; i++)
            {
                float health = spawnHealth(i);
                int   drop   = spawnDrop(i);
                int   speed  = spawnSpeed(i);

                bool overlimit = SpawnState.spawnRandom(health, drop, speed);
                while (!overlimit)
                {
                    yield return(new WaitForSeconds(0.5f));

                    overlimit = SpawnState.spawnRandom(health, drop, speed);
                }

                yield return(new WaitForSeconds(secondsBeforeNextSpawn));
            }

            while (GameState.numOfEnemies > 0)
            {
                yield return(new WaitForSeconds(0.5f));
            }

            roundNum += 1;
        }
    }