Fix inventory menu, add armor as equippable item

This commit is contained in:
2024-09-07 01:01:50 -07:00
parent dc035eb1fe
commit b478ad39fe
23 changed files with 305 additions and 84 deletions

View File

@@ -9,7 +9,7 @@ public interface IGameRepo : IDisposable
{
event Action? Ended;
IAutoProp<List<InventoryItemInfo>> InventoryItems { get; }
AutoProp<List<InventoryItemInfo>> InventoryItems { get; }
IAutoProp<bool> IsInventoryScreenOpened { get; }
@@ -23,7 +23,13 @@ public interface IGameRepo : IDisposable
void SetPlayerGlobalPosition(Vector3 playerGlobalPosition);
public Weapon EquippedWeapon { get; }
public void OnWeaponEquipped(WeaponInfo equippedItem);
public void OnArmorEquipped(ArmorInfo equippedItem);
public WeaponInfo EquippedWeapon { get; }
public ArmorInfo EquippedArmor { get; }
public AutoProp<int> HPBarValue { get; }
@@ -37,7 +43,7 @@ public class GameRepo : IGameRepo
private readonly AutoProp<List<InventoryItemInfo>> _inventoryItems;
private readonly AutoProp<bool> _isInventoryScreenOpened;
public IAutoProp<List<InventoryItemInfo>> InventoryItems => _inventoryItems;
public AutoProp<List<InventoryItemInfo>> InventoryItems => _inventoryItems;
public IAutoProp<bool> IsInventoryScreenOpened => _isInventoryScreenOpened;
@@ -47,8 +53,12 @@ public class GameRepo : IGameRepo
public IAutoProp<bool> IsPaused => _isPaused;
private readonly AutoProp<bool> _isPaused;
private Weapon _equippedWeapon;
public Weapon EquippedWeapon => _equippedWeapon;
private WeaponInfo _equippedWeapon;
public WeaponInfo EquippedWeapon => _equippedWeapon;
private ArmorInfo _equippedArmor;
public ArmorInfo EquippedArmor => _equippedArmor;
public AutoProp<int> HPBarValue { get; }
@@ -62,7 +72,7 @@ public class GameRepo : IGameRepo
_isInventoryScreenOpened = new AutoProp<bool>(false);
_isPaused = new AutoProp<bool>(false);
_playerGlobalPosition = new AutoProp<Vector3>(Vector3.Zero);
_equippedWeapon = new Weapon();
_equippedWeapon = WeaponInfo.Default;
HPBarValue = new AutoProp<int>(0);
VTBarValue = new AutoProp<int>(0);
}
@@ -81,6 +91,16 @@ public class GameRepo : IGameRepo
public void SetPlayerGlobalPosition(Vector3 playerGlobalPosition) => _playerGlobalPosition.OnNext(playerGlobalPosition);
public void OnWeaponEquipped(WeaponInfo equippedItem)
{
_equippedWeapon = equippedItem;
}
public void OnArmorEquipped(ArmorInfo equippedItem)
{
_equippedArmor = equippedItem;
}
public void OnGameEnded()
{
Pause();