SupaLidlGame/Items/Item.cs

42 lines
921 B
C#
Raw Permalink Normal View History

2022-11-13 19:52:09 -08:00
using Godot;
using SupaLidlGame.Characters;
namespace SupaLidlGame.Items
{
public abstract partial class Item : Node2D
{
2023-03-19 13:54:48 -07:00
[Export]
2023-03-26 21:11:38 -07:00
public ItemInfo Info { get; set; }
2023-03-19 23:36:36 -07:00
2023-03-26 13:03:45 -07:00
public Character CharacterOwner { get; set; }
2023-03-19 13:54:48 -07:00
/// <summary>
2023-03-19 23:36:36 -07:00
/// Determines if this item can directly stack with other items
2023-03-19 13:54:48 -07:00
/// </summary>
public virtual bool StacksWith(Item item)
{
2023-03-26 21:11:38 -07:00
if (!Info.CanStack)
2023-03-19 13:54:48 -07:00
{
return false;
}
2023-03-26 21:11:38 -07:00
if (Info.ItemName != item.Info.ItemName)
2023-03-19 13:54:48 -07:00
{
2023-03-19 23:36:36 -07:00
return false;
2023-03-19 13:54:48 -07:00
}
// several more conditions may be added soon
2023-03-19 23:36:36 -07:00
return true;
2023-03-19 13:54:48 -07:00
}
2022-11-13 19:52:09 -08:00
public abstract void Equip(Character character);
public abstract void Unequip(Character character);
public abstract void Use();
public abstract void Deuse();
}
}