ld: basic greyboxing

This commit is contained in:
2025-05-21 17:15:40 +02:00
parent c91e91f5c3
commit b3a28436bc
3 changed files with 68 additions and 10 deletions

View File

@ -21,6 +21,8 @@ public partial class HealthSystem : Node3D
public float CurrentHealth { get; set; } = 100.0f;
[Export(PropertyHint.Range, "0,100,0.1,or_greater")]
public float MinimalDamageUnit { get; set; } = 25.0f;
[Export(PropertyHint.Range, "-100,0,0.1,or_smaller")]
public float ThresholdVelYForDamage { get; set; } = -15.0f;
[ExportSubgroup("Regeneration")]
[Export(PropertyHint.Range, "0,10,0.01,suffix:s,or_greater")]
public float SecondsBeforeRegeneration { get; set; } = 5.5f;
@ -104,8 +106,6 @@ public partial class HealthSystem : Node3D
// Required to hide Vignette effect
private float _currentHealthInPrevFrame;
private float _thresholdVelYForDamage = -15.0f;
private float _currentVelocityYInAir;
private Gravity _gravity;
@ -441,10 +441,10 @@ public partial class HealthSystem : Node3D
}
else
{
if (_currentVelocityYInAir < _thresholdVelYForDamage)
if (_currentVelocityYInAir < ThresholdVelYForDamage && ThresholdVelYForDamage > 0)
{
float hit = Mathf.Remap(_currentVelocityYInAir,
_thresholdVelYForDamage, _thresholdVelYForDamage - 9.0f,
ThresholdVelYForDamage, ThresholdVelYForDamage - 9.0f,
MinimalDamageUnit, MaxHealth);
GD.Print("Hit damage: ", hit);