Moved the player inventory and selected slot to VesnaEntity
This commit is contained in:
@@ -3,6 +3,8 @@ using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Babushka.scripts.CSharp.Common.Inventory;
|
||||
using Babushka.scripts.CSharp.Common.Util;
|
||||
using Babushka.scripts.CSharp.GameEntity.Entities;
|
||||
using Babushka.scripts.CSharp.GameEntity.Management;
|
||||
|
||||
namespace Babushka.scripts.CSharp.Common.Fight.Actions;
|
||||
|
||||
@@ -17,7 +19,7 @@ public class EatBeetrootAction : FighterAction
|
||||
{
|
||||
Debug.Assert(FightWorld.Instance.itemBeetrootToEatForHealth != null,
|
||||
"Item to eat for health has not been set in the FightWorld autoload");
|
||||
return !InventoryManager.Instance.playerInventory!.HasItems(new ItemInstance
|
||||
return !EntityManager.Instance.GetUniqueEntity<VesnaEntity>().inventory.HasItems(new ItemInstance
|
||||
{ blueprint = FightWorld.Instance.itemBeetrootToEatForHealth });
|
||||
}
|
||||
|
||||
@@ -35,7 +37,7 @@ public class EatBeetrootAction : FighterAction
|
||||
{
|
||||
var fighter = HappeningData.fighterTurn.Current;
|
||||
|
||||
var result = InventoryManager.Instance.playerInventory!.TryRemoveAllItems(
|
||||
var result = EntityManager.Instance.GetUniqueEntity<VesnaEntity>().inventory.TryRemoveAllItems(
|
||||
new ItemInstance { blueprint = FightWorld.Instance.itemBeetrootToEatForHealth! });
|
||||
|
||||
if (result != InventoryActionResult.Success)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Babushka.scripts.CSharp.Common.Inventory;
|
||||
using Babushka.scripts.CSharp.GameEntity.Entities;
|
||||
using Babushka.scripts.CSharp.GameEntity.Management;
|
||||
using Godot;
|
||||
|
||||
namespace Babushka.scripts.CSharp.Common.Fight.UI;
|
||||
@@ -9,7 +11,7 @@ public partial class HealButtonVisual : Button
|
||||
|
||||
public void UpdateText()
|
||||
{
|
||||
var healItemsLeft = InventoryManager.Instance.playerInventory!.TotalItemsOfBlueprint(_healItemBlueprint);
|
||||
var healItemsLeft = EntityManager.Instance.GetUniqueEntity<VesnaEntity>().inventory.TotalItemsOfBlueprint(_healItemBlueprint);
|
||||
Text = $"x{healItemsLeft} - Heal";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user