Example #1
0
 public void TakeDamage(float damage)
 {
     if (dead == false)
     {
         gameObject.GetComponent <SkelStateMachine> ().currentState = gameObject.GetComponent <SkelStateMachine> ().attackingState;
         currentHealth -= damage;
         float cHealth = currentHealth / health;
         if (cHealth >= 0)
         {
             SetHealthBar(cHealth);
         }
         if (currentHealth <= 0)
         {
             anim.SetBool("Dead", true);
             dead = true;
             gameObject.SendMessage("Dead");
             DropGold();
             OverHHealth.SetActive(false);
             questManager.AddQuestObjective(iD);
         }
         Attack();
     }
 }