2025-03-21 10:30:44 +01:00
|
|
|
|
using Cirno.Scripts.Enums;
|
2025-03-21 15:33:37 +01:00
|
|
|
|
using Godot;
|
2025-03-21 10:30:44 +01:00
|
|
|
|
|
|
|
|
|
|
namespace Cirno.Scripts.Components.FSM.Enemy;
|
|
|
|
|
|
|
|
|
|
|
|
public partial class Dead : EnemyStateBase
|
|
|
|
|
|
{
|
|
|
|
|
|
public override EnemyState StateId => EnemyState.Dead;
|
2025-03-21 15:33:37 +01:00
|
|
|
|
|
|
|
|
|
|
[Export]
|
|
|
|
|
|
public EnemyStorageModule StorageModule { get; private set; }
|
2025-03-21 16:03:44 +01:00
|
|
|
|
|
|
|
|
|
|
[Export]
|
|
|
|
|
|
public EnemyDropsProvider DropsProvider { get; private set; }
|
2025-03-21 15:33:37 +01:00
|
|
|
|
|
|
|
|
|
|
// public override void Init(IStateMachine<EnemyState, CharacterBody2D> machine)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// base.Init(machine);
|
|
|
|
|
|
//
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
public override void EnterState()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.EnterState();
|
|
|
|
|
|
|
|
|
|
|
|
// Play death script
|
|
|
|
|
|
if (StorageModule.Root.DefeatScript is IActivable activatable)
|
|
|
|
|
|
{
|
|
|
|
|
|
activatable.Activate(StorageModule.Root.ActivationType);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-21 16:03:44 +01:00
|
|
|
|
DropsProvider.DropLoot();
|
2025-03-21 15:33:37 +01:00
|
|
|
|
|
2025-03-31 18:28:33 +02:00
|
|
|
|
GameManager.Instance.AddMotivation(StorageModule.EnemyData.MotivationReward);
|
|
|
|
|
|
|
2025-04-17 17:42:24 +02:00
|
|
|
|
StorageModule.Root.TriggerDeath();
|
|
|
|
|
|
|
2025-03-21 16:03:44 +01:00
|
|
|
|
StorageModule.Root.QueueFree();
|
2025-03-21 15:33:37 +01:00
|
|
|
|
}
|
2025-03-21 10:30:44 +01:00
|
|
|
|
}
|