Gamemanager in bullet

This commit is contained in:
MaddoScientisto 2025-02-13 21:55:14 +01:00
commit 1ee8f085e8
6 changed files with 92 additions and 13 deletions

View file

@ -17,6 +17,8 @@ public partial class Barrel : Area2D, IDestructible
[Export] public PackedScene ExplosionParticles { get; set; }
[Export] public BulletResource ExplosionData { get; set; }
private GameManager _gameManager;
private float _currentHealth = 0f;
private bool _isDestroyed = false;
@ -24,6 +26,7 @@ public partial class Barrel : Area2D, IDestructible
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
_gameManager = this.GetGameManager();
_currentHealth = Health;
}
@ -48,7 +51,7 @@ public partial class Barrel : Area2D, IDestructible
var explosion = this.CreateSibling<Bullet>(ExplosionData.BulletScene);
explosion.Speed = 0;
explosion.Initialize(ExplosionData.MakeBullet(this.GlobalPosition));
explosion.Initialize(ExplosionData.MakeBullet(this.GlobalPosition), _gameManager);
}
private void ApplyExplosionDamage()