Inventory close and open by button

This commit is contained in:
Marco 2025-03-01 20:50:47 +01:00
commit 80a13d047d
11 changed files with 165 additions and 53 deletions

View file

@ -1,4 +1,5 @@
using Godot;
using Cirno.Scripts.Components.Actors;
using Godot;
namespace Cirno.Scripts.Components.FSM.Player;
@ -6,33 +7,58 @@ public partial class Dead : PlayerFSMState
{
[Export]
private PlayerAnimationProvider _animationProvider;
[Export]
private InputProvider _inputProvider;
[Export]
private ActorResourceProvider _healthProvider;
private GameManager _gameManager;
private Hud _hud;
public override void Init(ActorStateMachine stateMachine)
{
base.Init(stateMachine);
// get hud?
_gameManager = GameManager.Instance;
_hud = Hud.Instance;
}
public override void EnterState()
{
_animationProvider.PlayDeathAnimation();
// show game over
_hud.ShowGameOver();
}
public override void ExitState()
{
// Hide game over
_hud.HideGameOver();
}
public override void ProcessState(double delta)
{
// wait for button
if (_inputProvider.GetShootJustPressed())
{
Respawn();
}
}
public override void PhysicsProcessState(double delta)
{
}
public void Respawn()
{
_stateMachine.GlobalPosition = _gameManager.LastCheckpointPosition;
_healthProvider.FillResource();
_gameManager.ClearBullets();
_stateMachine.SetState((int)PlayerState.Active);
}
}