Added critical hit boolean check and unit receiveDamage function
This commit is contained in:
parent
95df43a4b8
commit
80b3eb0dc7
1 changed files with 12 additions and 1 deletions
|
@ -64,10 +64,21 @@ public class UnitBehaviour : MonoBehaviour {
|
|||
attackElem = e;
|
||||
}
|
||||
|
||||
bool attack() {
|
||||
bool attackHit() {
|
||||
return (Random.Range (0, 100) < precision);
|
||||
}
|
||||
|
||||
bool criticalHit() {
|
||||
return (Random.Range (0, 100) < critChance);
|
||||
}
|
||||
|
||||
void receiveDamage(int damage) {
|
||||
if (health <= damage)
|
||||
Die ();
|
||||
else
|
||||
health -= damage;
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
|
|
Loading…
Reference in a new issue