Implement Equip/Unequip SFX

This commit is contained in:
2025-03-11 16:51:22 -07:00
parent 294c52dc40
commit 29af9062b5
12 changed files with 135 additions and 67 deletions

View File

@@ -384,6 +384,9 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
public void Equip(EquipableItem equipable)
{
if (string.IsNullOrEmpty(equipable.ItemName))
return;
if (equipable is Weapon weapon)
{
Unequip(_equippedWeapon.Value);
@@ -404,10 +407,15 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
}
else
throw new NotImplementedException("Item type is not supported.");
_gameRepo.OnEquippedItem(equipable);
}
public void Unequip(EquipableItem equipable)
{
if (string.IsNullOrEmpty(equipable.ItemName))
return;
if (equipable is Weapon weapon)
{
weapon.IsEquipped = false;
@@ -435,6 +443,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
if (equipable.ItemTag == ItemTag.BreaksOnChange)
Inventory.Remove(equipable);
_gameRepo.OnUnequippedItem(equipable);
}
private static Vector3 GlobalInputVector