mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:15:45 +00:00
Capacitors and parallax
This commit is contained in:
parent
c5ed30f458
commit
3670da9719
29 changed files with 705 additions and 57 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue