Wall-nut
This commit is contained in:
parent
f4caadad99
commit
2c8bb1d652
6 changed files with 199 additions and 15 deletions
|
|
@ -15,6 +15,9 @@ public partial class RuntimePlantData : Node2D, IEntity
|
|||
public int Line {get; set;}
|
||||
public PlantResource Resource;
|
||||
|
||||
[Signal]
|
||||
public delegate void OnHPChangedEventHandler(int amount);
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_hp = _maxHP;
|
||||
|
|
@ -24,6 +27,8 @@ public partial class RuntimePlantData : Node2D, IEntity
|
|||
{
|
||||
_hp += amount;
|
||||
|
||||
EmitSignal(SignalName.OnHPChanged,amount);
|
||||
|
||||
if (MaxHp > 0)
|
||||
{
|
||||
_hp = MaxHp;
|
||||
|
|
@ -34,6 +39,8 @@ public partial class RuntimePlantData : Node2D, IEntity
|
|||
{
|
||||
_hp -= amount;
|
||||
|
||||
EmitSignal(SignalName.OnHPChanged,-amount);
|
||||
|
||||
if (_hp <= 0)
|
||||
{
|
||||
Kill();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue