Beispiel #1
0
    // Assume character can indeed dash
    public static void DashMove(MovementController movementController, float speed, bool slope = true)
    {
        float linearVelocity = speed;

        if (!movementController.IsFacingRight()) // player is facing left
        {
            linearVelocity = -linearVelocity;
        }

        if (slope && movementController.IsOnSlope() && !movementController.IsAirborne())
        {
            movementController.MoveOnSlope(linearVelocity);
        }
        else
        {
            movementController.SetHorizontal(linearVelocity);
            BasicMovement.StopVertical(movementController);
        }
    }