Enemy state machine

This commit is contained in:
Marco 2025-03-20 18:22:40 +01:00
commit ef6c240e8e
37 changed files with 545 additions and 36 deletions

View file

@ -1,4 +1,5 @@
using Cirno.Scripts.Components.Actors;
using Cirno.Scripts.Enums;
using Godot;
public partial class ActorAi : ActorModule

View file

@ -4,6 +4,7 @@ using Cirno.Scripts.Components;
using System.Collections.Generic;
using System.Linq;
using Cirno.Scripts.Components.Actors;
using Cirno.Scripts.Enums;
public partial class EnemyNavigationMovement : MovementHandler
{

View file

@ -1,4 +1,5 @@
using Godot;
using Cirno.Scripts.Enums;
using Godot;
namespace Cirno.Scripts.Components.Actors;

View file

@ -16,6 +16,10 @@ public partial class GenericDamageReceiver : Area2D, IHittable
[Export] public PackedScene Debris { get; set; }
[Export] public Array<DamageResistance> DamageResistances { get; set; } = [];
[Export] public bool DeleteParentOnDeath { get; private set; } = true;
//[Signal] public delegate void DeathEventHandler();
private Node2D _parent;
@ -69,6 +73,12 @@ public partial class GenericDamageReceiver : Area2D, IHittable
_parent.CreateSibling<Node2D>(Debris);
}
_parent.QueueFree();
// Not needed because the health provider is accessible
//EmitSignal(SignalName.Death);
if (DeleteParentOnDeath)
{
_parent.QueueFree();
}
}
}