newlon/scripts/plants/behaviours/HpBasedBehaviour.cs
2025-07-11 22:35:36 +05:00

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);
}
}