mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 09:35:34 +00:00
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using Godot;
|
|
|
|
namespace Cirno.Scripts.Components.FSM.Player;
|
|
|
|
public partial class Init : PlayerStateBase
|
|
{
|
|
public override PlayerState StateId => PlayerState.Init;
|
|
|
|
private PlayerAnimationProvider _animationProvider;
|
|
|
|
private PlayerStorageModule _storageModule;
|
|
|
|
public override void EnterState()
|
|
{
|
|
// Resolve modules lazily to avoid method/class name conflicts with Init
|
|
_animationProvider ??= StateMachine.GetModule<PlayerAnimationProvider>();
|
|
_storageModule ??= StateMachine.GetModule<PlayerStorageModule>();
|
|
|
|
if (_storageModule != null)
|
|
_storageModule.FacingDirection = ((PlayerStateMachine)StateMachine).StartingDirection;
|
|
|
|
if (_animationProvider != null)
|
|
{
|
|
_animationProvider.PlayUnteleportAnimation();
|
|
// If you need to wait for animation end, subscribe here
|
|
}
|
|
|
|
var timer = GetTree().CreateTimer(0.5f);
|
|
timer.Timeout += () => StateMachine.SetState(PlayerState.Active);
|
|
}
|
|
|
|
public override void ExitState()
|
|
{
|
|
|
|
}
|
|
|
|
public override void PhysicsProcessState(double delta)
|
|
{
|
|
|
|
}
|
|
|
|
public override void ProcessState(double delta)
|
|
{
|
|
|
|
}
|
|
}
|