mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-14 10:43:47 +00:00
Shield handling
This commit is contained in:
parent
60a6a4927c
commit
e6c880e918
1 changed files with 19 additions and 1 deletions
|
|
@ -391,12 +391,30 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
|
|||
GD.Print($"Player damaged for {damage}");
|
||||
if (_isDestroyed) return;
|
||||
|
||||
CurrentHealth -= damage;
|
||||
if (CurrentShield > 0 && type is not DamageType.Explosive or DamageType.Acid) {
|
||||
// Reduce shield
|
||||
CurrentShield -= damage;
|
||||
if (_currentHealth < 0 ) {
|
||||
CurrentHealth -= Math.Abs(CurrentShield);
|
||||
CurrentShield = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (type is DamageType.Fire) {
|
||||
CurrentHealth -= damage * 2;
|
||||
}
|
||||
else {
|
||||
CurrentHealth -= damage;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(CurrentHealth <= 0)) return;
|
||||
_isDestroyed = true;
|
||||
Explode();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool IsDestroyed()
|
||||
{
|
||||
return _isDestroyed;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue