Changed zombie speed from int to floatmod, added hobo
This commit is contained in:
parent
5d8e45469d
commit
ad8ecb875a
9 changed files with 310 additions and 158 deletions
|
|
@ -8,26 +8,30 @@ public partial class EatBox : Area2D
|
|||
{
|
||||
// Rewrite this class completely when field system will be introduced.
|
||||
|
||||
[Export] private int _damage;
|
||||
[Export] private AnimationTree _animationTree;
|
||||
[Export] private FloatModifiers _damage;
|
||||
private RuntimePlantData plant;
|
||||
|
||||
public bool isEating = false;
|
||||
|
||||
public void Bite()
|
||||
{
|
||||
if (GetParent<RuntimeZombieData>().AbleToEat)
|
||||
plant?.TakeDamage(_damage,GetParent());
|
||||
{
|
||||
plant?.TakeDamage((int)_damage.GetValue(), GetParent());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void OnAreaEntered(Area2D area)
|
||||
{
|
||||
var parent = area.GetParent();
|
||||
GD.Print(parent.Name);
|
||||
|
||||
if (parent != null && parent is RuntimePlantData plantData)
|
||||
{
|
||||
plant = plantData;
|
||||
_animationTree.Set("parameters/conditions/eat", true);
|
||||
_animationTree.Set("parameters/conditions/end_eat", false);
|
||||
isEating = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -38,8 +42,7 @@ public partial class EatBox : Area2D
|
|||
if (parent == plant)
|
||||
{
|
||||
plant = null;
|
||||
_animationTree.Set("parameters/conditions/eat", false);
|
||||
_animationTree.Set("parameters/conditions/end_eat", true);
|
||||
isEating = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue