Redesign and reimplement inventory menu
Add jewels but no implementation yet (needed redesign of inventory menu to function correctly)
This commit is contained in:
@@ -11,6 +11,7 @@ using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Zennysoft.Game.Implementation;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class Game : Node3D, IGame
|
||||
@@ -226,6 +227,9 @@ public partial class Game : Node3D, IGame
|
||||
case ThrowableItem throwableItem:
|
||||
EnactThrowableItemEffects(throwableItem);
|
||||
break;
|
||||
case Jewel jewel:
|
||||
EnactJewelItemEffects(jewel);
|
||||
break;
|
||||
}
|
||||
|
||||
await ToSignal(GetTree().CreateTimer(0.3f), "timeout");
|
||||
@@ -240,6 +244,7 @@ public partial class Game : Node3D, IGame
|
||||
dropped.Item = item;
|
||||
_map.AddChild(dropped);
|
||||
dropped.Drop();
|
||||
_player.Inventory.Remove(item);
|
||||
}
|
||||
|
||||
public void SetItem(InventoryItem item)
|
||||
@@ -248,6 +253,7 @@ public partial class Game : Node3D, IGame
|
||||
var setItem = setScene.Instantiate<SetItem>();
|
||||
_map.AddChild(setItem);
|
||||
setItem.Set();
|
||||
_player.Inventory.Remove(item);
|
||||
}
|
||||
|
||||
public void ThrowItem(InventoryItem item)
|
||||
@@ -257,6 +263,7 @@ public partial class Game : Node3D, IGame
|
||||
thrown.ItemThatIsThrown = item;
|
||||
_map.AddChild(thrown);
|
||||
thrown.Throw(_effectService);
|
||||
_player.Inventory.Remove(item);
|
||||
}
|
||||
|
||||
public IDungeonFloor CurrentFloor => _map.CurrentFloor;
|
||||
@@ -560,9 +567,6 @@ public partial class Game : Node3D, IGame
|
||||
_effectService.TeleportToRandomRoom(_player);
|
||||
GameRepo.CloseInventory();
|
||||
break;
|
||||
case ThrowableItemTag.CanChangeAffinity:
|
||||
_effectService.ChangeAffinity(throwableItem);
|
||||
break;
|
||||
case ThrowableItemTag.WarpToExitIfFound:
|
||||
_effectService.WarpToExit();
|
||||
GameRepo.CloseInventory();
|
||||
@@ -575,10 +579,17 @@ public partial class Game : Node3D, IGame
|
||||
_player.VTComponent.Restore(throwableItem.HealVTAmount);
|
||||
}
|
||||
|
||||
private void EnactJewelItemEffects(Jewel jewel)
|
||||
{
|
||||
switch (jewel.Stats.JewelTag)
|
||||
{
|
||||
//case JewelTags.AeolicElement
|
||||
}
|
||||
}
|
||||
private void RemoveItemOrSubtractFromItemCount(InventoryItem item)
|
||||
{
|
||||
if (item is IStackable stackableItem && stackableItem.Count > 1)
|
||||
stackableItem.SetCount(stackableItem.Count - 1);
|
||||
if (item is IStackable stackableItem && stackableItem.Count.Value > 1)
|
||||
stackableItem.SetCount(stackableItem.Count.Value - 1);
|
||||
else
|
||||
_player.Inventory.Remove(item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user