Zombie now eat when can

This commit is contained in:
Rendo 2025-07-13 22:36:53 +05:00
commit 0592751a25
7 changed files with 76 additions and 81 deletions

View file

@ -9,6 +9,8 @@ public partial class EatBox : Area2D
// Rewrite this class completely when field system will be introduced.
[Export] public FloatModifiers _damage;
[Export]
private AudioStream biteSound = ResourceLoader.Load<AudioStream>("uid://dyid55nhflwyn");
private RuntimePlantData plant;
public bool isEating = false;
@ -18,6 +20,7 @@ public partial class EatBox : Area2D
if (GetParent<RuntimeZombieData>().AbleToEat)
{
plant?.TakeDamage((int)_damage.GetValue(), GetParent());
AudioSequencer.Play("bite", biteSound);
}
}

View file

@ -6,10 +6,6 @@ public partial class RuntimeZombieData : Entity
{
[Export]
private Armor _armor;
[Export]
private AudioStream garlicSound;
[Export]
private AudioStream freezeSound;
[Signal] public delegate void HasBeenKilledEventHandler(RuntimeZombieData who);
public bool AbleToEat = true;