Пример #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();
        }
    }
Пример #2
0
    private void Awake()
    {
        if (enemyType == EnemyType.Small)
        {
            tankSpeed  = 600;
            shellSpeed = 1300;

            armor = 1;

            primaryDirection   = .45f;
            secondaryDirection = .45f;
            awayDirection      = .05f;

            minMoveChangeDelay = 3f;
            maxMoveChangeDelay = 5f;

            minFireDelay = 3f;
            maxFireDelay = 5f;

            preferredTarget = Target.Player;
        }
        else if (enemyType == EnemyType.Fast)
        {
            tankSpeed  = 1000;
            shellSpeed = 1300;

            armor = 1;

            primaryDirection   = .6f;
            secondaryDirection = .3f;
            awayDirection      = .05f;

            minMoveChangeDelay = 1f;
            maxMoveChangeDelay = 5f;

            minFireDelay = 1f;
            maxFireDelay = 5f;

            preferredTarget = Target.Eagle;
        }
        else if (enemyType == EnemyType.Heavy)
        {
            tankSpeed  = 600;
            shellSpeed = 2000;

            armor = 1;

            primaryDirection   = .8f;
            secondaryDirection = .2f;
            awayDirection      = .00000000001f;

            minMoveChangeDelay = 3f;
            maxMoveChangeDelay = 5f;

            minFireDelay = 1f;
            maxFireDelay = 3.5f;

            preferredTarget = Target.Player;
        }
        else if (enemyType == EnemyType.Armored)
        {
            tankSpeed  = 400;
            shellSpeed = 2200;

            armor = 4;

            primaryDirection   = .8f;
            secondaryDirection = .2f;
            awayDirection      = .00000000001f;

            minMoveChangeDelay = 5f;
            maxMoveChangeDelay = 6f;

            minFireDelay = 3f;
            maxFireDelay = 5f;

            preferredTarget = Target.Player;
        }

        //PU and respective animation
        indexTankWithPU = new List <int>()
        {
            7, 10, 13, 16, 17, 18
        };
        int siblingIndex = EnemySpawnerController.GetNumberEnemiesSpawned();

        if (indexTankWithPU.Any(i => i == siblingIndex))
        {
            hasPU = true;
        }
        else
        {
            hasPU = false;
        }

        anim = GetComponent <Animator>();
    }