Finish refactoring other than making sure bonuses appear on player stat side
This commit is contained in:
@@ -5,6 +5,7 @@ namespace GameJamDungeon
|
||||
{
|
||||
public interface IInventoryItem : INode3D
|
||||
{
|
||||
public Guid ID { get; }
|
||||
public IGameRepo GameRepo { get; }
|
||||
|
||||
public InventoryItemStats Info { get; }
|
||||
|
||||
@@ -22,6 +22,8 @@ public partial class Accessory : Node3D, IInventoryItem, IEquipable
|
||||
|
||||
[Node] public Area3D Pickup { get; set; } = default!;
|
||||
|
||||
public Guid ID => Guid.NewGuid();
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
Sprite.Texture = AccessoryInfo.Texture;
|
||||
|
||||
@@ -20,6 +20,8 @@ public partial class Armor : Node3D, IInventoryItem, IEquipable
|
||||
|
||||
[Node] public Area3D Pickup { get; set; } = default!;
|
||||
|
||||
public Guid ID => Guid.NewGuid();
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
Sprite.Texture = ArmorStats.Texture;
|
||||
|
||||
@@ -21,6 +21,8 @@ public partial class ConsumableItem : Node3D, IInventoryItem
|
||||
|
||||
[Node] public Area3D Pickup { get; set; } = default!;
|
||||
|
||||
public Guid ID => Guid.NewGuid();
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
Sprite.Texture = ConsumableItemInfo.Texture;
|
||||
@@ -45,28 +47,28 @@ public partial class ConsumableItem : Node3D, IInventoryItem
|
||||
{
|
||||
if (GameRepo.PlayerData.CurrentHP == GameRepo.PlayerData.MaximumHP)
|
||||
{
|
||||
GameRepo.PlayerData.MaximumHP.OnNext(GameRepo.PlayerData.MaximumHP.Value + ConsumableItemInfo.RaiseHPAmount);
|
||||
GameRepo.PlayerData.CurrentHP.OnNext(GameRepo.PlayerData.MaximumHP.Value);
|
||||
GameRepo.PlayerData.SetMaximumHP(GameRepo.PlayerData.MaximumHP.Value + ConsumableItemInfo.RaiseHPAmount);
|
||||
GameRepo.PlayerData.SetCurrentHP(GameRepo.PlayerData.MaximumHP.Value);
|
||||
}
|
||||
}
|
||||
|
||||
private void HealHP()
|
||||
{
|
||||
GameRepo.PlayerData.CurrentHP.OnNext(GameRepo.PlayerData.CurrentHP.Value + ConsumableItemInfo.HealHPAmount);
|
||||
GameRepo.PlayerData.SetCurrentHP(GameRepo.PlayerData.CurrentHP.Value + ConsumableItemInfo.HealHPAmount);
|
||||
}
|
||||
|
||||
private void RaiseVT()
|
||||
{
|
||||
if (GameRepo.PlayerData.CurrentVT == GameRepo.PlayerData.MaximumVT)
|
||||
{
|
||||
GameRepo.PlayerData.MaximumVT.OnNext(GameRepo.PlayerData.MaximumVT.Value + ConsumableItemInfo.RaiseVTAmount);
|
||||
GameRepo.PlayerData.CurrentVT.OnNext(GameRepo.PlayerData.MaximumVT.Value);
|
||||
GameRepo.PlayerData.SetMaximumVT(GameRepo.PlayerData.MaximumVT.Value + ConsumableItemInfo.RaiseVTAmount);
|
||||
GameRepo.PlayerData.SetCurrentVT(GameRepo.PlayerData.MaximumVT.Value);
|
||||
}
|
||||
}
|
||||
|
||||
private void HealVT()
|
||||
{
|
||||
GameRepo.PlayerData.CurrentVT.OnNext(GameRepo.PlayerData.CurrentVT.Value + ConsumableItemInfo.HealVTAmount);
|
||||
GameRepo.PlayerData.SetCurrentVT(GameRepo.PlayerData.CurrentVT.Value + ConsumableItemInfo.HealVTAmount);
|
||||
}
|
||||
|
||||
public void Throw()
|
||||
|
||||
@@ -21,6 +21,8 @@ public partial class ThrowableItem : Node3D, IInventoryItem
|
||||
|
||||
public int Count { get; }
|
||||
|
||||
public Guid ID => Guid.NewGuid();
|
||||
|
||||
[Export]
|
||||
public ThrowableItemStats ThrowableItemInfo { get; set; }
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ public partial class Weapon : Node3D, IInventoryItem, IEquipable
|
||||
|
||||
[Node] public Area3D Pickup { get; set; } = default!;
|
||||
|
||||
public Guid ID => Guid.NewGuid();
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
Sprite.Texture = WeaponStats.Texture;
|
||||
|
||||
Reference in New Issue
Block a user