Ejemplo n.º 1
0
    protected override void Update()
    {
        base.Update();

        if (!startGame)
        {
            return;
        }

        if (!startWaitComplete)
        {
            PressAnyKeyToStart();
        }
        else if (!isGameOver && CheckGameOver())
        {
            GameOver();
        }
        else
        {
            //Check if either player earned a bonus life.
            BonusLifeGainCheck();

            //check timer has elapsed before checking asteroids active.
            checkEmptyTimer += Time.deltaTime;


            if (mState == State.Playing && checkEmptyTimer >= checkEmptyTimerLimit)
            {
                checkEmptyTimer = 0.0f;
                //If there are no active asteroids.
                if (!spawner.isAnyAsteroidActive())
                {
                    //Set modifier for round increase upping
                    RoundLogic();
                }
            }

            /*
             * //Check for pause key - DISABLED DUE TO LACK OF FORESIGHT INVOLVING COROUTINES.
             * if(Input.GetKeyDown(KeyCode.Escape))
             * {
             *      if(mState == State.Playing)
             *      {
             *              PauseGame();
             *      }
             *      else
             *      {
             *              UnpauseGame();
             *      }
             * }
             */
        }
    }
Ejemplo n.º 2
0
    private void RoundCheck()
    {
        StopAllCoroutines();

        //Check if criteria for round ending is true
        if (!asteroidSpawner.isAnyAsteroidActive() && !ufoSpawner.isAnyUFOActive())
        {
            //	If this was the last round of the set, stop any additional spawns,
            if (roundNumber == RoundsUntilShop)
            {
                roundNumber = 0;

                //fade out game and show shop
                StartCoroutine(ShopIntroSequence());
            }
            else
            {
                RoundIncrementLogic();
                roundNumber++;
                SpawnAll();
            }
        }
    }