Helpful comments requested, please.
Code: Select all
using System;
namespace BloodRage
{
namespace Core
{
class BRHealth
{
protected int _Health = 0;
protected int _Death = 0;
protected int _FullHealth = 0;
protected bool _Alive = false;
public bool IsAlive
{
get { return (this._Alive); }
}
public int Health
{
get { return (this._Health); }
set { UpdateHealth(value); }
}
// constructor
public BRHealth(int health, int death, int fullHealth)
{
this.Init(health, death, fullHealth);
}
// Deconstructor
~BRHealth()
{
}
private bool Init(int health, int death, int fullHealth)
{
//if(health < death || fullHealth < death)
//{
// throw
//}
this._Health = health;
this._Death = death;
this._FullHealth = fullHealth;
// IsAlive?
return(this.CheckHealth());
}
private void UpdateHealth(int health)
{
this._Health = health;
this.CheckHealth();
}
protected bool CheckHealth()
{
// false : oh crap he is dead!
// true : yup heart is still beating!
return(this._Alive = (this._Health == this._Death ? false : true));
}
}
}
}