Capacitors and parallax

This commit is contained in:
Marco 2025-02-21 16:27:57 +01:00
commit 3670da9719
29 changed files with 705 additions and 57 deletions

View file

@ -19,6 +19,16 @@ public partial class Barrel : Area2D, IDestructible
[Export] public BulletOwner BulletGroup { get; set; } = BulletOwner.None;
[ExportCategory("On Death Activation")]
[Export]
public ActivationType ActivationType { get; private set; } = ActivationType.Toggle;
[Export]
public Node2D Target { get; private set;}
[Signal]
public delegate void ExplodedEventHandler();
private GameManager _gameManager;
private float _currentHealth = 0f;
@ -40,12 +50,22 @@ public partial class Barrel : Area2D, IDestructible
private void Explode()
{
//ApplyExplosionDamage();
EmitSignal(SignalName.Exploded, this, _currentHealth);
ActivateOnDeath();
CreateExplosion();
CreateParticles();
CreateDebris();
QueueFree();
}
private void ActivateOnDeath()
{
if (Target is IActivable node)
{
node.Activate(ActivationType);
}
}
private void CreateExplosion()
{
if (ExplosionData == null) return;