Files
GameJamDungeon/Zennysoft.Game.Ma/src/items/throwable/ThrowableItem.cs

57 lines
1.5 KiB
C#

using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using Zennysoft.Game.Abstractions;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode)), Id("throwable_item")]
public partial class ThrowableItem : InventoryItem, IStackable
{
public override void _Notification(int what) => this.Notify(what);
[Node] private Sprite3D _sprite { get; set; } = default!;
public override void _Ready()
{
_sprite.Texture = Stats.Texture;
}
public override string ItemName => Stats.Name;
public override string Description => Stats.Description;
public override float SpawnRate => Stats.SpawnRate;
public override int ThrowDamage => Stats.ThrowDamage;
public override float ThrowSpeed => Stats.ThrowSpeed;
public ElementType ElementType => Stats.ElementType;
public ThrowableItemTag ThrowableItemTag => Stats.ThrowableItemTag;
public int HealHPAmount => Stats.HealHPAmount;
public int HealVTAmount => Stats.HealVTAmount;
public override ItemTag ItemTag => Stats.ItemTag;
public void SetElementType(ElementType elementType) => Stats.ElementType = elementType;
public void SetDescription(string description) => Stats.Description = description;
[Save("throwable_item_count")]
public int Count { get; private set; } = 1;
[Export]
[Save("throwable_item_stats")]
public ThrowableItemStats Stats { get; set; }
public override Texture2D GetTexture() => Stats.Texture;
public void SetCount(int count) => Count = count;
}