Ejemplo n.º 1
0
    private IEnumerator PlayCurrentLevelScript()
    {
        if (currentLevel == 1)
        {
            yield return(new WaitWhile(() => isPlayerReady == false));

            PlayerSpawner.SpawnPlayer();
            yield return(new WaitForSeconds(4f));

            TooltipController.PlayTooltipAnimation(Tooltip.Eagle, false);
            PauseManager.FreezeDynamicObjects();
            EnemySpawnerController.SetSpawnFrequency(.8f);
            EnemySpawnerController.SetSpawnStartTime(0f);

            //Freeze as soon as spawned has been called on the 3rd enemy
            yield return(new WaitWhile(() => EnemySpawnerController.GetNumberEnemiesSpawned() != 3));

            PauseManager.FreezeDynamicObjects();
            onSpawnSfx = false;

            //Show crosshairs once all three enemies are spawned and on scene
            yield return(new WaitWhile(() => enemyTankParentObject.transform.childCount != 3));

            TooltipController.PlayTooltipAnimation(Tooltip.FirstWave, false);
            EnemySpawnerController.SetSpawnFrequency(4f);
            EnemySpawnerController.SetSpawnStartTime(1f);

            yield return(new WaitWhile(() => EnemySpawnerController.GetNumberEnemiesSpawned() != 4));

            TooltipController.PlayTooltipAnimation(Tooltip.Ammo, true);
            yield return(new WaitForSeconds(.5f));

            TooltipController.PlayTooltipAnimation(Tooltip.HealthBar, true);
            yield return(new WaitForSeconds(.5f));

            TooltipController.PlayTooltipAnimation(Tooltip.Lives, true);

            //Show tooltip on first enemy that has power up
            yield return(new WaitWhile(() => EnemySpawnerController.GetNumberEnemiesSpawned() != 7));

            TooltipController.PlayTooltipAnimation(Tooltip.FirstPU, false);
            PauseManager.FreezeDynamicObjects();
        }
        else if (currentLevel == 2)
        {
            onSpawnSfx = false;
            yield return(new WaitWhile(() => isPlayerReady == false));

            PlayerSpawner.SpawnPlayer();
        }
    }