Ejemplo n.º 1
0
    /// <summary>
    /// Coroutine to manage the time elapsed sinche the player throw the balls, to prevent the game for getting stuck
    /// by accelerating the balls and send them to the bottom.
    /// </summary>
    private IEnumerator CheckElapsedTime()
    {
        int  accelerations = 0;
        uint myThrow       = _throwNumber;

        while (_ballsThrowed)
        {
            yield return(new WaitForSeconds(WAITING_MAX_TIME));

            if (_ballsThrowed && !_gamePaused && myThrow == _throwNumber)
            {
                if (accelerations < MAX_ACCELERATIONS)
                {
                    AccelerateGame();
                    accelerations++;
                }
                else
                {
                    _ballManager.DecreaseBallsDirections();
                }
            }
        }
    }