Weapon switching

This commit is contained in:
MaddoScientisto 2025-04-09 23:24:55 +02:00
commit 036cc4b940
10 changed files with 49 additions and 17 deletions

View file

@ -9,7 +9,7 @@ namespace Cirno.Scripts.Components.Actors;
public partial class PlayerWeaponProvider : Node2D
{
[Export] public PackedScene WeaponTemplate { get; private set; }
public Array<Weapon> EquippedWeapons { get; set; } = new Array<Weapon>();
public Array<Weapon> EquippedWeapons { get; set; } = [];
public int CurrentWeaponIndex { get; set; } = 0;
private InventoryManager _inventoryManager;

View file

@ -187,4 +187,16 @@ public partial class Active : PlayerStateBase
{
_activationProvider.HandleInteraction();
}
private void HandleWeaponSwitch()
{
if (_inputProvider.GetWeaponNextJustPressed())
{
_weaponProvider.NextWeapon();
}
else if (_inputProvider.GetWeaponPreviousJustPressed())
{
_weaponProvider.PreviousWeapon();
}
}
}