newlon/scripts/components/plants/behaviours/HpBasedBehaviour.cs

18 lines
418 B
C#

using Godot;
namespace Newlon.Components.Plants.Behaviours;
public partial class HpBasedBehaviour : BaseBehaviour
{
private RuntimePlantData _data;
public override void _Ready()
{
base._Ready();
_data = GetParent<RuntimePlantData>();
}
public void OnHPChanged(int amount,Node origin)
{
_tree.Set("parameters/Tree/blend_position",(float)_data.HP/_data.MaxHP);
}
}