Particles system
This commit is contained in:
parent
30266b36cf
commit
0e5dee50f7
46 changed files with 643 additions and 200 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
using Newlon.Components.Zombies;
|
||||
|
||||
namespace Newlon.Components.Plants;
|
||||
|
|
@ -6,15 +7,19 @@ namespace Newlon.Components.Plants;
|
|||
public partial class ExplosionComponent : Area2D
|
||||
{
|
||||
[Export] private int damage;
|
||||
[Export] private PackedScene particles;
|
||||
|
||||
public void Explode()
|
||||
{
|
||||
foreach(var zombie in GetOverlappingAreas())
|
||||
foreach (var zombie in GetOverlappingAreas())
|
||||
{
|
||||
var zombieData = zombie.GetParent<RuntimeZombieData>();
|
||||
zombieData?.TakeDamage(damage,GetParent());
|
||||
zombieData?.TakeDamage(damage, GetParent());
|
||||
}
|
||||
|
||||
PoolContainer.Instance.SpawnParticles(particles, GetParent<RuntimePlantData>().GlobalPosition);
|
||||
|
||||
GetParent<RuntimePlantData>().Kill();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue