mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-21 11:33:47 +00:00
Weapon hud fix
This commit is contained in:
parent
eb1e8cfcb8
commit
19da648f62
3 changed files with 17 additions and 3 deletions
|
|
@ -152,6 +152,8 @@ public partial class PlayerWeaponProvider : Node2D
|
||||||
|
|
||||||
_switching = true;
|
_switching = true;
|
||||||
_switchCooldown = 0d;
|
_switchCooldown = 0d;
|
||||||
|
|
||||||
|
InventoryManager.Instance.UpdateEquippedWeapon(weapon.WeaponData.ItemKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NextWeapon()
|
public void NextWeapon()
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ public partial class GameManager : Node2D
|
||||||
//_inventoryManager.ItemAdded += (item, currentAmount) => _hud.AddInventoryItem(item, currentAmount);
|
//_inventoryManager.ItemAdded += (item, currentAmount) => _hud.AddInventoryItem(item, currentAmount);
|
||||||
//_inventoryManager.ItemRemoved += (item, currentAmount) => _hud.RemoveInventoryItem(item, currentAmount);
|
//_inventoryManager.ItemRemoved += (item, currentAmount) => _hud.RemoveInventoryItem(item, currentAmount);
|
||||||
|
|
||||||
_inventoryManager.WeaponEquip += key => _hud.EquipWeapon(key);
|
_inventoryManager.WeaponUpdate += key => _hud.EquipWeapon(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerRespawned += OnPlayerRespawned;
|
PlayerRespawned += OnPlayerRespawned;
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,15 @@ public partial class InventoryManager : Node2D
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void ItemRemovedEventHandler(string itemKey, int currentAmount);
|
public delegate void ItemRemovedEventHandler(string itemKey, int currentAmount);
|
||||||
|
|
||||||
[Signal]
|
/// <summary>
|
||||||
public delegate void WeaponEquipEventHandler(string itemKey);
|
/// Use when equipping a weapon from the inventory screen
|
||||||
|
/// </summary>
|
||||||
|
[Signal] public delegate void WeaponEquipEventHandler(string itemKey);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Use when updating the weapon shown on the hud
|
||||||
|
/// </summary>
|
||||||
|
[Signal] public delegate void WeaponUpdateEventHandler(string itemKey);
|
||||||
|
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void ItemUsedEventHandler(LootItem itemKey, int totalCount);
|
public delegate void ItemUsedEventHandler(LootItem itemKey, int totalCount);
|
||||||
|
|
@ -208,6 +215,11 @@ public partial class InventoryManager : Node2D
|
||||||
|
|
||||||
GD.Print($"Items after loading: {_itemsDict.Count}");
|
GD.Print($"Items after loading: {_itemsDict.Count}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateEquippedWeapon(string itemKey)
|
||||||
|
{
|
||||||
|
EmitSignalWeaponUpdate(itemKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ItemContainer
|
public class ItemContainer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue