예제 #1
0
    private IEnumerator RushStartAnimation()
    {
        _bIsRushing        = true;
        _rushTimeRemaining = RushDuration;
        _thePlayer.SetGravity(0f);
        _thePlayer.SetVelocity(new Vector2(8f, 0f));
        if (_epicDashEnabled)
        {
            _thePlayer.SetAnimation("Rush"); // TODO special dash
        }
        else
        {
            _thePlayer.SetAnimation("Rush");
        }
        _lantern.AddRushForce();

        const float startupDuration = 0.07f;
        float       animTimer       = 0f;

        while (animTimer < startupDuration && !_bDisabled)
        {
            if (!_bPaused)
            {
                animTimer += Time.deltaTime;
            }
            yield return(null);
        }

        if (_bPaused)
        {
            yield break;
        }
        _thePlayer.SetPlayerSpeed(RushSpeed);
        _thePlayer.SetVelocity(Vector2.zero);
        _gameHandler.UpdateGameSpeed(RushSpeed);
    }