예제 #1
0
 public void OnDamageTouch(IDamaging ec)
 {
     if (invincLeft > 0)
     {
         return;
     }
     if (lastHit < Time.time - .75 && alive)
     {
         int damage = (int)Random.Range(ec.GetDamageRange().x *GameController.maincontroller.difficutlyScale, ec.GetDamageRange().y *GameController.maincontroller.difficutlyScale + 1);
         AchievementTracker.instance.GetDamage(damage);
         this.health -= damage;
         if (damage > 0)
         {
             Grunt();
         }
         if (health <= 0)
         {
             health = 0;
             if (alive)
             {
                 Die();
             }
         }
         uic.DisplayHearts(this.health, this.maxhealth);
         lastHit = Time.time;
     }
 }