feat: split player movement into ground and noclip strategies

This commit is contained in:
2026-08-22 22:22:51 +02:00
parent 45c66ca7db
commit 76694a40f6
14 changed files with 123 additions and 62 deletions
@@ -0,0 +1,23 @@
using Godot;
namespace Game.Features.Players.Domain.Movement;
public sealed class NoclipMovement(float flySpeed) : IMovementStrategy
{
public Vector3 CalculateVelocity(Vector3 currentVelocity, MovementInput input)
{
Vector3 moveDirection = input.Right * input.Direction.X + input.Back * input.Direction.Y;
if (input.AscendPressed)
{
moveDirection += Vector3.Up;
}
if (input.DescendPressed)
{
moveDirection += Vector3.Down;
}
return moveDirection.Length() > 0f ? moveDirection.Normalized() * flySpeed : Vector3.Zero;
}
}