Files
night-shift/src/Features/Players/Domain/Movement/NoclipMovement.cs
T

24 lines
625 B
C#

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;
}
}