31 lines
710 B
C#
31 lines
710 B
C#
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();
|
|
}
|
|
}
|