Moved the player inventory and selected slot to VesnaEntity
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Babushka.scripts.CSharp.Common.Farming;
|
||||
using System;
|
||||
using Babushka.scripts.CSharp.Common.Farming;
|
||||
using Babushka.scripts.CSharp.Common.Inventory;
|
||||
using Babushka.scripts.CSharp.GameEntity.Management;
|
||||
using Godot;
|
||||
|
||||
@@ -8,7 +10,23 @@ public class VesnaEntity : PositionalEntity
|
||||
{
|
||||
public override string EntityType => OWN_TYPE_NAME;
|
||||
public const string OWN_TYPE_NAME = "VesnaEntity";
|
||||
public readonly InventoryInstance inventory = new (37);
|
||||
|
||||
public event Action<int>? SlotIndexChanged;
|
||||
|
||||
private int _currentSelectedSlotIndex;
|
||||
public int CurrentSelectedSlotIndex
|
||||
{
|
||||
get => _currentSelectedSlotIndex;
|
||||
set
|
||||
{
|
||||
if (value >= 0 && value <= 8)
|
||||
{
|
||||
_currentSelectedSlotIndex = value;
|
||||
SlotIndexChanged?.Invoke(_currentSelectedSlotIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void InstantiateEntityNode(Node2D parent)
|
||||
{
|
||||
var node = (VesnaBehaviour2D) EntityManager.Instance.NodeCreator.InstantiateNode(OWN_TYPE_NAME);
|
||||
|
||||
Reference in New Issue
Block a user