Motivation

This commit is contained in:
Marco 2025-03-31 18:28:33 +02:00
commit e73596e464
13 changed files with 100 additions and 34 deletions

View file

@ -16,12 +16,23 @@ public partial class Dead : PlayerStateBase
[Export]
private ActorResourceProvider _healthProvider;
[Export]
private ActorResourceProvider _motivationProvider;
public override void EnterState()
{
_animationProvider.PlayDeathAnimation();
// show game over
Hud.Instance.ShowGameOver();
if (_motivationProvider.CurrentResource < 100f)
{
// If motivation is not enough show game over scene
GD.Print("Game over");
}
else
{
// Else show respawn notification
Hud.Instance.ShowGameOver();
}
}
public override void ExitState()
@ -49,6 +60,12 @@ public partial class Dead : PlayerStateBase
MainObject.GlobalPosition = GameManager.Instance.LastCheckpointPosition;
_healthProvider.FillResource();
GameManager.Instance.ClearBullets();
_motivationProvider.CurrentResource -= 100f;
if (_motivationProvider.CurrentResource <= 1f)
{
_motivationProvider.CurrentResource = 1f;
}
ChangeState(PlayerState.Active);
}