Throw item

This commit is contained in:
2024-09-01 17:51:16 -07:00
parent dc3639ad6e
commit dc9d9c4589
7 changed files with 130 additions and 6 deletions

View File

@@ -0,0 +1,30 @@
using Chickensoft.AutoInject;
using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection;
using Godot;
public interface IThrowableItem : INode3D
{
public IAnimationPlayer AnimationPlayer { get; set; }
}
[Meta(typeof(IAutoNode))]
public partial class ThrowableItem : Node3D, IThrowableItem
{
public override void _Notification(int what) => this.Notify(what);
[Node] public IAnimationPlayer AnimationPlayer { get; set; } = default!;
[Node] public IHitbox Hitbox { get; set; } = default!;
public void Setup()
{
AnimationPlayer.AnimationFinished += OnAnimationFinished;
Hitbox.Damage = 5;
}
private void OnAnimationFinished(StringName animName)
{
QueueFree();
}
}