mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-14 00:15:54 +00:00
Add FSM components for player and enemy state management, including initialization and module resolution
This commit is contained in:
parent
18683c0680
commit
b6cc5a00e8
57 changed files with 526 additions and 506 deletions
45
Scripts/Components/FSM/Enemy/InitState.cs
Normal file
45
Scripts/Components/FSM/Enemy/InitState.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using Cirno.Scripts.Components.Actors;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Enemy;
|
||||
|
||||
public partial class InitState : EnemyStateBase
|
||||
{
|
||||
public override EnemyState StateId => EnemyState.Init;
|
||||
|
||||
private GenericDamageReceiver DamageReceiver { get; set; }
|
||||
|
||||
private EnemyStorageModule StorageModule { get; set; }
|
||||
|
||||
public override void Init(IStateMachine<EnemyState, CharacterBody2D> machine)
|
||||
{
|
||||
base.Init(machine);
|
||||
DamageReceiver ??= StateMachine.GetModule<GenericDamageReceiver>();
|
||||
StorageModule ??= StateMachine.GetModule<EnemyStorageModule>();
|
||||
}
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
DamageReceiver.HealthProvider.MaxResource = StorageModule.Root.EnemyResource.MaxHealth;
|
||||
|
||||
StorageModule.AiState = StorageModule.Root.StartingAiState;
|
||||
|
||||
StorageModule.HomePosition = MainObject.GlobalPosition;
|
||||
// TODO: Hide wings
|
||||
// TODO: Hide aiming reticule
|
||||
|
||||
StateMachine.SetState(EnemyState.Idle);
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue