mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-14 14:23:47 +00:00
Modularized doors and lightbridges
This commit is contained in:
parent
1a24711984
commit
1a5bd1b6d8
27 changed files with 513 additions and 346 deletions
|
|
@ -15,6 +15,8 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
private ActorResourceProvider _healthProvider;
|
||||
[Export]
|
||||
private ActorResourceProvider _shieldProvider;
|
||||
|
||||
[Export] public StringName AcidGroupName { get; private set; } = "Acid";
|
||||
|
||||
[Signal]
|
||||
public delegate void HealthChangedEventHandler(float newValue, float maxValue);
|
||||
|
|
@ -88,10 +90,23 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
{
|
||||
if (!Enabled) return;
|
||||
if (Invulnerable) return;
|
||||
if (area.IsInGroup(AcidGroupName))
|
||||
{
|
||||
// Handle acid death
|
||||
AcidDeath();
|
||||
return;
|
||||
}
|
||||
if (area is not Bullet bullet || bullet.BulletOwner == BulletGroup) return;
|
||||
this.Hit(bullet.Damage, bullet.DamageType);
|
||||
bullet.RequestCollisionDestruction();
|
||||
}
|
||||
|
||||
private void AcidDeath()
|
||||
{
|
||||
if (!Enabled) return;
|
||||
GD.Print("Acid death");
|
||||
_healthProvider.CurrentResource = 0;
|
||||
}
|
||||
|
||||
public void Hit(float damage, DamageType type = DamageType.Neutral)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue