Add projectiles

This commit is contained in:
2026-02-10 18:03:53 -08:00
parent 2f377d2d7a
commit 92b4e8662f
41 changed files with 2170 additions and 42 deletions

View File

@@ -0,0 +1,49 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
using Zennysoft.Game.Abstractions;
using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
[Meta(typeof(IAutoNode)), Id("ammo")]
public partial class Ammo : EquipableItem, IStackable
{
public override void _Notification(int what) => this.Notify(what);
private int _count;
[Node] private Sprite3D _sprite { get; set; }
public void OnReady()
{
_count = Stats.InitialCount;
_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 override ItemTag ItemTag => Stats.ItemTag;
public override Texture2D GetTexture() => Stats.Texture;
[Save("ammo_item_count")]
public int Count { get => _count; }
public void SetCount(int count) => _count = count;
[Save("ammo_element")]
public ElementType AmmoElement => Stats.AmmoElement;
[Export]
[Save("ammo_stats")]
public AmmoStats Stats { get; set; } = new AmmoStats();
}