mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-15 12:53:47 +00:00
Enemy AI
This commit is contained in:
parent
383fc740df
commit
ede8f2028a
34 changed files with 1418 additions and 417 deletions
78
Scripts/Components/FSM/Enemy/3D/EnemyProxy3D.cs
Normal file
78
Scripts/Components/FSM/Enemy/3D/EnemyProxy3D.cs
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
using Cirno.Scripts.Enums;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Cirno.Scripts.Resources.Loot;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Enemy._3D;
|
||||
|
||||
public partial class EnemyProxy3D : CharacterBody3D, IActivable
|
||||
{
|
||||
[Export] public EnemyStateMachine3D EnemyFSM { get; private set; }
|
||||
|
||||
[Export] public EnemyResource EnemyResource { get; private set; }
|
||||
|
||||
[Export] public Array<LootDrop> ExtraLoot { get; private set; } = [];
|
||||
|
||||
[Export] public bool OverrideLoot { get; set; } = false;
|
||||
|
||||
[Export]
|
||||
public AiState StartingAiState { get; private set; }
|
||||
|
||||
[ExportCategory("Defeat Script")]
|
||||
[Export] public Node DefeatScript { get; set; }
|
||||
|
||||
[Export] public ActivationType ActivationType { get; private set; } = ActivationType.Toggle;
|
||||
|
||||
[Signal] public delegate void DeathEventHandler(EnemyProxy3D enemy);
|
||||
|
||||
public void Init(EnemyResource enemyResource)
|
||||
{
|
||||
this.EnemyResource = enemyResource;
|
||||
|
||||
}
|
||||
|
||||
public void TriggerDeath()
|
||||
{
|
||||
EmitSignalDeath(this);
|
||||
}
|
||||
|
||||
public void RequestAlert(Vector3 destination)
|
||||
{
|
||||
//EnemyFSM.SetState(EnemyState.Alert);
|
||||
}
|
||||
|
||||
public bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
switch (activationType)
|
||||
{
|
||||
case ActivationType.Toggle:
|
||||
EnemyFSM.SetState(EnemyState.Controlled);
|
||||
break;
|
||||
case ActivationType.Enable:
|
||||
// Enable or disable AI
|
||||
EnemyFSM.SetState(EnemyState.Shooting);
|
||||
break;
|
||||
case ActivationType.Disable:
|
||||
EnemyFSM.SetState(EnemyState.Idle);
|
||||
// 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;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue