20 lines
399 B
C#
20 lines
399 B
C#
using Godot;
|
|
using Newlon.Components.Zombies;
|
|
|
|
namespace Newlon.Components.Plants;
|
|
|
|
public partial class ExplosionComponent : Area2D
|
|
{
|
|
[Export] private int damage;
|
|
|
|
public void Explode()
|
|
{
|
|
foreach(var zombie in GetOverlappingAreas())
|
|
{
|
|
var zombieData = zombie.GetParent<RuntimeZombieData>();
|
|
zombieData?.TakeDamage(damage,GetParent());
|
|
}
|
|
|
|
GetParent<RuntimePlantData>().Kill();
|
|
}
|
|
}
|