Garlic
This commit is contained in:
parent
34638272aa
commit
2e3226b5c1
14 changed files with 200 additions and 10 deletions
19
scripts/components/plants/ReturnEffect.cs
Normal file
19
scripts/components/plants/ReturnEffect.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Zombies;
|
||||
using Newlon.Systems.Effects;
|
||||
|
||||
namespace Newlon.Components.Plants;
|
||||
|
||||
public partial class ReturnEffect : Node
|
||||
{
|
||||
[Export]
|
||||
private Effect _effectToReturn;
|
||||
|
||||
public void OnDamageRecieved(int delta,Node origin)
|
||||
{
|
||||
if (origin is RuntimeZombieData zombie)
|
||||
{
|
||||
zombie.GiveEffect(_effectToReturn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,8 @@ public partial class EatBox : Area2D
|
|||
|
||||
public void Bite()
|
||||
{
|
||||
plant?.TakeDamage(_damage,GetParent());
|
||||
if (GetParent<RuntimeZombieData>().AbleToEat)
|
||||
plant?.TakeDamage(_damage,GetParent());
|
||||
}
|
||||
|
||||
public void OnAreaEntered(Area2D area)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ public partial class RuntimeZombieData : Node2D, IEntity, ILocalTimescale, IEffe
|
|||
|
||||
public int Line => _line;
|
||||
|
||||
public bool AbleToEat = true;
|
||||
|
||||
public float LocalTimescale
|
||||
{
|
||||
get => _localTimescale;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue