void Awake()
 {
     poolYard = GameObject.FindGameObjectWithTag("PoolYard").GetComponent <PoolYard>();
     if (Aims)
     {
         player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
     }
 }
 void Awake()
 {
     poolYard  = GameObject.FindGameObjectWithTag("PoolYard").GetComponent <PoolYard>();
     lootTable = new PoolController[] {
         poolYard.pool_item_Page,
         poolYard.pool_item_Potion,
         poolYard.pool_item_Attack
     };
 }
Example #3
0
 void Awake()
 {
     if (gameController == null)
     {
         gameController = GameObject.Find("Game").GetComponent <GameController>();
     }
     if (playerController == null)
     {
         playerController = GameObject.Find("Player").GetComponent <Player>();
     }
     poolYard = GameObject.FindGameObjectWithTag("PoolYard").GetComponent <PoolYard>();
     // if(explosionPool == null){
     //  explosionPool = GameObject.Find("ExplosionController").GetComponent<PoolController>();
     // }
 }
    public IEnumerator PlayEndlessWaves()
    {
        EnemyRangesMinion.EnemyPool   = gameController.levelController.MinionPool;
        EnemyRangesFighter.EnemyPool  = gameController.levelController.FighterPool;
        EnemyRangesChampion.EnemyPool = gameController.levelController.ChampionPool;
        EnemyRangesHero.EnemyPool     = gameController.levelController.HeroPool;

        poolYard  = GameObject.FindGameObjectWithTag("PoolYard").GetComponent <PoolYard>();
        lootTable = new PoolController[] {
            poolYard.pool_item_Page,
            poolYard.pool_item_Potion,
            poolYard.pool_item_Attack
        };

        ////Move player
        gameController.player.MovePlayerTo(new Vector2(0, -2.5f));
        yield return(new WaitUntil(gameController.PlayerMovementComplete));


        Debug.Log(EnemyRangesMinion.EnemyPool != null);

        while (true)
        {
            gameController.UpdateTitleText("Wave: " + WaveNumber, 1);

            SpawnEnemies(EnemyRangesMinion, WaveNumber);
            SpawnEnemies(EnemyRangesFighter, WaveNumber);
            SpawnEnemies(EnemyRangesChampion, WaveNumber);
            SpawnEnemies(EnemyRangesHero, WaveNumber);

            yield return(new WaitUntil(gameController.AllBadGuysAreDeadOrPlayer));

            if (gameController.IsGameOver)
            {
                gameController.UpdateTitleText("Died On Wave: " + WaveNumber, 3);
                WaveNumber = 1;
                break;
            }

            ////SpawnItems
            DropItems();
            yield return(new WaitForSeconds(WavePause));

            WaveNumber++;
        }

        yield return(null);
    }