Moved events inside the player

This commit is contained in:
Maddo 2025-02-28 18:50:42 +01:00
commit 7d9db8cfb6
7 changed files with 57 additions and 75 deletions

View file

@ -163,6 +163,8 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
_selector.Visible = false;
}
_inventoryManager.ItemUsed += this.UseItem;
_lastCheckPointPosition = GlobalPosition;
_ = UnTeleport();
@ -260,16 +262,6 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
_weaponProvider.EquipWeapon(weapon);
}
public void NextWeapon()
{
_weaponProvider.NextWeapon();
}
public void PreviousWeapon()
{
_weaponProvider.PreviousWeapon();
}
private void FindInteractable()
{
var selected = _selector.SelectedInteractable;
@ -394,12 +386,12 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
if (Input.IsActionJustPressed(_nextWeaponActionName))
{
NextWeapon();
_weaponProvider.NextWeapon();
}
if (Input.IsActionJustPressed(_previousWeaponActionName))
{
PreviousWeapon();
_weaponProvider.PreviousWeapon();
}
_crosshair.Position = CalculateCrosshairPosition();