mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-10 08:05:54 +00:00
Motivation
This commit is contained in:
parent
c9b703a0ae
commit
e73596e464
13 changed files with 100 additions and 34 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue