Refactored my code with Strategy Pattern and now my CharacterBody2D won't move

Godot Version

4.2.1 stable

Question

Hello everyone. I decided to refactor my code and apply SOLID principles, not just to practise them but to learn new strategies regarding code, and also because my code was getting complicated to read.

I decided to apply the Strategy pattern in regards to movement, so the logistic in regards to movement is encapsulated in its own c and this would let me have my XAxis movement, and YAxis movement stored in different classes. The issue that comes to hand though is that, for some reason my character now won’t move, despite having it’s velocity changed.

This is the code regarding my YAxisMovement

public class YAxisMovement
{
	private float VelocityY { get; set; }

	public float GetVelocityY()
	{
		return VelocityY;
	}

	public YAxisMovement(Player player, double delta)
	{
		float velocityY = player.Velocity.Y;
		float JumpVelocity = Player.JumpVelocity;
		float gravity = player.Gravity;
		bool isJumping = !player.IsOnFloor();
		bool jumpPress = player.JumpPress;

		if (isJumping)
		{
			if (velocityY == 0)
			{
				jumpPress = false;
				Console.WriteLine("PEAK OF JUMP REACHED");
			}
			if (!jumpPress)
			{
				velocityY += gravity * 2f * (float)delta;
			}
			else
			{
				velocityY += gravity * (float)delta;
			}
		}

// Handle Jump.
		if (Input.IsActionJustPressed("jump") && !isJumping)
		{
			jumpPress = true;
			velocityY = JumpVelocity;
		}

//Manage jumpPress bool
		if (!Input.IsActionPressed("jump") && jumpPress)
		{
			jumpPress = false;
		}
		VelocityY = velocityY;
	}
}

This is the code regarding my WalkMovement:

public class WalkMovement : IMovementStrategy
    {
        
        public Vector2 Move(Player player, double delta)
        {
            Vector2 direction = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down");
            Vector2 velocity = new Vector2();
            float currentSpeed = player.CurrentSpeed;
            
            //Declare methods from another class so they manage them
            XAxisMovement XMovement = new XAxisMovement(direction.X, player, delta);
            YAxisMovement YMovement = new YAxisMovement(player, delta);
            // Check if sprint action is pressed and set the speed accordingly
            float speed = Input.IsActionPressed("sprint") ? Player.SprintSpeed : Player.WalkSpeed;
    
            velocity.X = XMovement.GetVelocityX();
            velocity.Y = YMovement.GetVelocityY();
        
            Console.WriteLine(currentSpeed +" /// " + player.Velocity);
            return velocity;
        }
        
    }

This is the (part of my) code regarding my Player and movement in general:

   public partial class Player : CharacterBody2D
    {
        //############
        // ATTRIBUTES
        //############
        public const float JumpVelocity = -450.0f;
        public float Gravity { get; } = ProjectSettings.GetSetting("physics/2d/default_gravity").AsSingle();
        [Export] public float Acceleration { get; set; }
        public static float WalkSpeed { get; set; } = 200.0f;
        public static float SprintSpeed { get; set; } = 300.0f;
        public float CurrentSpeed { get; set; }
        public Vector2 Velocity { get; set; }
        public AnimatedSprite2D Sprites { get; private set; }
        public CollisionShape2D CollisionShape { get; private set; }
        public bool JumpPress { get; set; }
    
        //INJECTIONS
        private IMovementStrategy _movementStrategy;
        private IPlayerState _currentState;
    
    
        public override void _Ready()
        {
           base._Ready();
           Sprites = (AnimatedSprite2D)GetNode("AnimatedSprite2D");
           CollisionShape = (CollisionShape2D)GetNode("CollisionShape2D");
           
           //Injects States and Strategy
           _movementStrategy = new WalkMovement();
           _currentState = new AliveState();
           _currentState.Enter(this);
    
        }
        
        public override void _PhysicsProcess(double delta)
        {
           //TODO: Fix character not moving
           _currentState.Execute(this, delta);
           Velocity = _movementStrategy.Move(this, delta);
           Console.WriteLine("THIS SHOULD BE THE VELOCITY OF THE PLAYER: " + Velocity);
           AnimationManager(Velocity);
            
           MoveAndSlide();
        }
    }

I’m just not too sure what’s wrong, I tried printing in console the Velocity and it looks ok, don’t know where to start.