示例#1
0
        private void MoveStateDash()
        {
            if (_moveStateMachine.IsStateNew())
            {
                _dashTime = 0f;
                _velocityComponent.SpeedPadding = 250f;
                _velocityComponent.YVelocity    = 0f;
                _velocityComponent.ApplyForce(ShouldGoLeft() ? Vector2.Left : Vector2.Right, 250f);
                _dashParticles.Emitting = true;
            }

            _dashTime += GetProcessDeltaTime() / Engine.TimeScale;

            _velocityComponent.ApplyGravity(.25f);
            _velocityComponent.Move();

            if (IsOnFloor())
            {
                _moveStateMachine.ChangeState(MoveStateGrounded);
            }
            else if (_dashTime > DASH_TIME)
            {
                _moveStateMachine.ChangeState(MoveStateAirborne);
            }

            UpdateAnimations();
        }