Nerdus
This commit is contained in:
parent
f37c5fb87c
commit
2156c6a166
16 changed files with 490 additions and 5 deletions
|
|
@ -1,18 +1,25 @@
|
|||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Newlon.Components.Plants.Behaviours;
|
||||
|
||||
public partial class HpBasedBehaviour : BaseBehaviour
|
||||
{
|
||||
private RuntimePlantData _data;
|
||||
[Export] private Array<string> parameters;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_data = GetParent<RuntimePlantData>();
|
||||
}
|
||||
|
||||
public void OnHPChanged(int amount,Node origin)
|
||||
public void OnHPChanged(int amount, Node origin)
|
||||
{
|
||||
_tree.Set("parameters/Tree/blend_position",(float)_data.HP/_data.MaxHP);
|
||||
var calc = (float)_data.HP / _data.MaxHP;
|
||||
foreach (var par in parameters)
|
||||
{
|
||||
_tree.Set(par, calc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue