mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
43 lines
911 B
C#
43 lines
911 B
C#
|
|
using Godot;
|
|||
|
|
|
|||
|
|
namespace Cirno.Scripts.Components.Actors;
|
|||
|
|
|
|||
|
|
public partial class ActorDefeatScriptHandler : ActorModule
|
|||
|
|
{
|
|||
|
|
[Export] public Node2D DefeatScript { get; private set; }
|
|||
|
|
[Export] public ActivationType ActivationType { get; private set; }
|
|||
|
|
protected Actor _actor;
|
|||
|
|
|
|||
|
|
public override void Init(Actor actor)
|
|||
|
|
{
|
|||
|
|
_actor = actor;
|
|||
|
|
DefeatScript = actor.DefeatScript;
|
|||
|
|
ActivationType = actor.ActivationType;
|
|||
|
|
_actor.OnDeath += ActorOnOnDeath;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ActorOnOnDeath()
|
|||
|
|
{
|
|||
|
|
ActivateDefeatScript();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void Update(double delta)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void PhysicsUpdate(double delta)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void ActivateDefeatScript()
|
|||
|
|
{
|
|||
|
|
if (DefeatScript is not IActivable target)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
target?.Activate();
|
|||
|
|
}
|
|||
|
|
}
|