feat: split player movement into ground and noclip strategies
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user