Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (!initialCalculationComplete)
     {
         Calculate();
     }
     if (maxHP == 0)
     {
         return;
     }
     if (hp <= 0)
     {
         hp = 0;
         if (GetComponent <Monster>() != null)
         {
             GetComponent <MonsterMortal>().OnDeath();
         }
     }
     else if (hp > maxHP)
     {
         hp = maxHP;
     }
     if (!isPlayer && unitFrame != null)
     {
         unitFrame.SetHealthPercentage(hp / maxHP * 100f);
     }
 }