64 lines
1.7 KiB
C#
64 lines
1.7 KiB
C#
using Chickensoft.AutoInject;
|
|
using Chickensoft.Collections;
|
|
using Chickensoft.Introspection;
|
|
using Chickensoft.Serialization;
|
|
using Godot;
|
|
using Zennysoft.Game.Implementation;
|
|
using Zennysoft.Ma.Adapter;
|
|
|
|
namespace Zennysoft.Game.Ma;
|
|
|
|
[Meta(typeof(IAutoNode)), Id("throwable_item")]
|
|
public partial class ThrowableItem : Node3D, IBaseInventoryItem, IStackable
|
|
{
|
|
public override void _Notification(int what) => this.Notify(what);
|
|
|
|
[Node] private Sprite3D _sprite { get; set; } = default!;
|
|
|
|
public ThrowableItem()
|
|
{
|
|
var rng = new RandomNumberGenerator();
|
|
rng.Randomize();
|
|
Count = new AutoProp<int>(rng.RandiRange(1, 5));
|
|
}
|
|
|
|
public override void _Ready()
|
|
{
|
|
_sprite.Texture = Stats.Texture;
|
|
}
|
|
|
|
public string ItemName => Stats.Name;
|
|
|
|
public string Description => Stats.Description;
|
|
|
|
public float SpawnRate => Stats.SpawnRate;
|
|
|
|
public int ThrowDamage => Stats.ThrowDamage;
|
|
|
|
public float ThrowSpeed => Stats.ThrowSpeed;
|
|
|
|
[Save("throwable_item_element")]
|
|
public ElementType ElementType => Stats.ElementType;
|
|
[Save("throwable_item_heal_hp")]
|
|
public int HealHPAmount => Stats.HealHPAmount;
|
|
[Save("throwable_item_heal_vt")]
|
|
public int HealVTAmount => Stats.HealVTAmount;
|
|
|
|
public 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 AutoProp<int> Count { get; private set; }
|
|
|
|
[Export]
|
|
[Save("throwable_item_stats")]
|
|
public ThrowableItemStats Stats { get; set; }
|
|
|
|
public Texture2D GetTexture() => Stats.Texture;
|
|
|
|
public void SetCount(int count) => Count.OnNext(count);
|
|
}
|