Potato mine
This commit is contained in:
parent
e2cc168b72
commit
c428bf219d
6 changed files with 245 additions and 0 deletions
21
scripts/components/plants/ExplosionComponent.cs
Normal file
21
scripts/components/plants/ExplosionComponent.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using Godot;
|
||||
|
||||
public partial class ExplosionComponent : Node
|
||||
{
|
||||
[Export] private int damage;
|
||||
[Export] private Area2D explosionArea;
|
||||
|
||||
public void Explode()
|
||||
{
|
||||
foreach(var zombie in explosionArea.GetOverlappingAreas())
|
||||
{
|
||||
var zombieData = zombie.GetParent<RuntimeZombieData>();
|
||||
if (zombieData != null)
|
||||
{
|
||||
zombieData.TakeDamage(damage);
|
||||
}
|
||||
}
|
||||
|
||||
GetParent<RuntimePlantData>().Kill();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue