cirnogodot/Scripts/Components/FSM/Enemy/EnemyFSMProxy.cs

66 lines
1.8 KiB
C#
Raw Normal View History

2025-03-21 17:52:01 +01:00
using System;
using Cirno.Scripts.Enums;
2025-03-20 18:22:40 +01:00
using Cirno.Scripts.Resources;
using Cirno.Scripts.Resources.Loot;
using Godot;
using Godot.Collections;
namespace Cirno.Scripts.Components.FSM.Enemy;
2025-03-21 17:52:01 +01:00
public partial class EnemyFSMProxy : CharacterBody2D, IActivable
2025-03-20 18:22:40 +01:00
{
[Export] public EnemyStateMachine EnemyFSM { get; private set; }
[Export] public EnemyResource EnemyResource { get; private set; }
2025-03-21 16:03:44 +01:00
[Export] public Array<LootDrop> ExtraLoot { get; private set; } = [];
2025-04-25 18:33:20 +02:00
[Export] public bool OverrideLoot { get; set; } = false;
2025-03-20 18:22:40 +01:00
[Export]
public AiState StartingAiState { get; private set; }
[ExportCategory("Defeat Script")]
[Export] public Node2D DefeatScript { get; set; }
[Export] public ActivationType ActivationType { get; private set; } = ActivationType.Toggle;
2025-03-21 17:52:01 +01:00
2025-04-16 18:18:52 +02:00
[Signal] public delegate void DeathEventHandler(EnemyFSMProxy enemy);
public void TriggerDeath()
{
EmitSignalDeath(this);
}
2025-04-28 12:22:00 +02:00
public void RequestAlert(Vector2 destination)
{
//EnemyFSM.SetState(EnemyState.Alert);
}
2025-04-16 18:18:52 +02:00
2025-03-21 17:52:01 +01:00
public bool Activate(ActivationType activationType = ActivationType.Toggle)
{
switch (activationType)
{
case ActivationType.Toggle:
EnemyFSM.SetState(EnemyState.Controlled);
break;
case ActivationType.Enable:
// Enable or disable AI
break;
case ActivationType.Disable:
// Enable or disable AI
break;
case ActivationType.Use:
break;
case ActivationType.Destroy:
EnemyFSM.SetState(EnemyState.Dead);
break;
case ActivationType.Open:
break;
case ActivationType.Close:
break;
}
return true;
}
2025-03-20 18:22:40 +01:00
}