Controllable enemies

This commit is contained in:
Marco 2025-03-21 17:52:01 +01:00
commit 0aad79a0f8
18 changed files with 893 additions and 23 deletions

View file

@ -1,4 +1,5 @@
using Cirno.Scripts.Enums;
using System;
using Cirno.Scripts.Enums;
using Cirno.Scripts.Resources;
using Cirno.Scripts.Resources.Loot;
using Godot;
@ -6,7 +7,7 @@ using Godot.Collections;
namespace Cirno.Scripts.Components.FSM.Enemy;
public partial class EnemyFSMProxy : CharacterBody2D
public partial class EnemyFSMProxy : CharacterBody2D, IActivable
{
[Export] public EnemyStateMachine EnemyFSM { get; private set; }
@ -21,4 +22,31 @@ public partial class EnemyFSMProxy : CharacterBody2D
[Export] public Node2D DefeatScript { get; set; }
[Export] public ActivationType ActivationType { get; private set; } = ActivationType.Toggle;
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;
}
}