mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 18:05:53 +00:00
Motivation
This commit is contained in:
parent
c9b703a0ae
commit
e73596e464
13 changed files with 100 additions and 34 deletions
|
|
@ -22,6 +22,7 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
|
||||
[Export] public float BaseHealth { get; private set; } = 32f;
|
||||
[Export] public float BaseShield { get; private set; } = 32f;
|
||||
[Export] public float BaseMotivation { get; private set; } = 100f;
|
||||
|
||||
[Export] public float HealthExtendAmount { get; private set; } = 4f;
|
||||
[Export] public float ShieldExtendAmount { get; private set; } = 4f;
|
||||
|
|
@ -31,6 +32,7 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
private ActorResourceProvider _healthProvider;
|
||||
[Export]
|
||||
private ActorResourceProvider _shieldProvider;
|
||||
[Export] private ActorResourceProvider _motivationProvider;
|
||||
|
||||
[ExportCategory("Damage Types")]
|
||||
[Export] public StringName AcidGroupName { get; private set; } = "Acid";
|
||||
|
|
@ -62,6 +64,12 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
get => _shieldProvider.CurrentResource;
|
||||
set => _shieldProvider.CurrentResource = value;
|
||||
}
|
||||
|
||||
public float CurrentMotivation
|
||||
{
|
||||
get => _motivationProvider.CurrentResource;
|
||||
set => _motivationProvider.CurrentResource = value;
|
||||
}
|
||||
|
||||
private IStateMachine<PlayerState, CharacterBody2D> _stateMachine;
|
||||
|
||||
|
|
@ -110,6 +118,11 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
|
||||
SetMaxResources();
|
||||
};
|
||||
|
||||
_motivationProvider.ResourceChanged += (value, maxValue) =>
|
||||
{
|
||||
Hud.Instance?.UpdateMotivation(value, maxValue);
|
||||
};
|
||||
}
|
||||
|
||||
private void SetMaxResources()
|
||||
|
|
@ -121,6 +134,8 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
_healthProvider.MaxResource = BaseHealth + (healthExtends * HealthExtendAmount);
|
||||
|
||||
_shieldProvider.MaxResource = BaseShield + (shieldExtends * ShieldExtendAmount);
|
||||
|
||||
_motivationProvider.CurrentResource = BaseMotivation;
|
||||
}
|
||||
|
||||
public void RefillHealth()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue