Player movement and camera

This commit is contained in:
Marco 2025-06-11 15:28:26 +02:00
commit a324f2e347
43 changed files with 1777 additions and 316 deletions

View file

@ -81,52 +81,7 @@ public partial class Active : BaseState<PlayerState, CharacterBody3D>
{
base.ProcessState(delta);
_movementDirection = _inputProvider.GetMovementInput().Normalized();
_isStrafing = _inputProvider.GetStrafePressed();
// Toggle visibility of the hitbox sprite based on strafing
_hitboxSpriteProvider.SetVisibility(_isStrafing);
var rightStickInput = _inputProvider.GetAimInput().Normalized();
// Update Facing Direction
// if (!_isStrafing)
// {
if (rightStickInput.Length() > 0.1f) // If the right stick is moved
{
FacingDirection = rightStickInput;
}
else if (_movementDirection != Vector2.Zero) // Fall back to movement direction
{
FacingDirection = _movementDirection;
}
// }
_animationProvider.SetAnimationSpeed(MainObject.Velocity);
_animationProvider.SetAnimation(FacingDirection);
HandleWeaponSwitch();
_weaponProvider.Update(delta);
//_crosshairProvider.UpdatePosition(FacingDirection);
HandleShoot();
HandleInteraction();
// FindInteractable();
// _crosshair.Position = CalculateCrosshairPosition();
if (_inputProvider.GetInventoryJustPressed())
{
GameManager.Instance.ChangeState(GameState.Inventory);
}
if (_inputProvider.GetPauseJustPressed())
{
//CallDeferred(MethodName.PauseDeferred);
PauseDeferred();
}
}
private void PauseDeferred()
@ -134,32 +89,5 @@ public partial class Active : BaseState<PlayerState, CharacterBody3D>
GameManager.Instance.Pause();
}
// private void HandleShoot()
// {
// if (_inputProvider.GetReloadJustPressed())
// {
// _weaponProvider.Reload();
// return;
// }
//
// if (!_inputProvider.GetShootPressed()) return;
// _weaponProvider.Shoot(this.FacingDirection);
// }
//
// private void HandleInteraction()
// {
// _activationProvider.HandleInteraction();
// }
//
// private void HandleWeaponSwitch()
// {
// if (_inputProvider.GetWeaponNextJustPressed())
// {
// _weaponProvider.NextWeapon();
// }
// else if (_inputProvider.GetWeaponPreviousJustPressed())
// {
// _weaponProvider.PreviousWeapon();
// }
// }
}