Effects handling rework
This commit is contained in:
parent
08d593175b
commit
63930450a3
21 changed files with 100 additions and 228 deletions
|
|
@ -6,13 +6,13 @@ namespace Newlon.Components;
|
|||
public partial class Armor : Node
|
||||
{
|
||||
[Signal]
|
||||
public delegate void ArmorDamagedEventHandler(int hp);
|
||||
public delegate void ArmorDamagedEventHandler(float hp);
|
||||
[Signal]
|
||||
public delegate void ArmorLostEventHandler();
|
||||
|
||||
[Export]
|
||||
public int MaxHP { get; private set; }
|
||||
private int _hp;
|
||||
public float MaxHP { get; private set; }
|
||||
private float _hp;
|
||||
private bool _lost = false;
|
||||
|
||||
public override void _Ready()
|
||||
|
|
@ -20,11 +20,11 @@ public partial class Armor : Node
|
|||
_hp = MaxHP;
|
||||
}
|
||||
|
||||
public int RecieveDamage(int damage)
|
||||
public float RecieveDamage(float damage)
|
||||
{
|
||||
if(_lost)
|
||||
return damage;
|
||||
int returnAmount = 0;
|
||||
float returnAmount = 0;
|
||||
_hp -= damage;
|
||||
if(_hp <= 0)
|
||||
{
|
||||
|
|
@ -37,11 +37,11 @@ public partial class Armor : Node
|
|||
return returnAmount;
|
||||
}
|
||||
|
||||
public int Heal(int amount)
|
||||
public float Heal(float amount)
|
||||
{
|
||||
if(_lost)
|
||||
return amount;
|
||||
int returnAmount = 0;
|
||||
float returnAmount = 0;
|
||||
_hp += amount;
|
||||
if (_hp >= MaxHP)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue