18 lines
417 B
C#
18 lines
417 B
C#
using Godot;
|
|
using Godot.Collections;
|
|
|
|
namespace Newlon.Components.Plants.Behaviours;
|
|
|
|
public partial class HpBasedBehaviour : BaseBehaviour
|
|
{
|
|
[Export] private Array<string> parameters;
|
|
|
|
public void OnHPChanged(EntitySignalContext context)
|
|
{
|
|
var calc = context.target.HP / context.target.MaxHP;
|
|
foreach (var par in parameters)
|
|
{
|
|
_tree.Set(par, calc);
|
|
}
|
|
}
|
|
}
|