Esempio n. 1
0
 /// <summary>
 /// Deals damage to the character.
 /// </summary>
 /// <param name="amount">Value to be taken.</param>
 public void TakeHealth(float amount) //IDE1006 Name Violation
 {
     Debug.Log(blocking.blocked);
     //Checks for blocking before taking health, takes stamina instead of blocking.
     if (blocking.perfectBlock) //If the block is perfect take only half the amount off.
     {
         blocking.timer.time = blocking.timer.time - (amount / 2);
     }
     else if (blocking.blocked) //Consider making this a private method
     {
         blocking.timer.time -= amount;
     }
     else
     {
         health            -= amount;
         healthSlider.value = health;
         fill.color         = gradient.Evaluate(healthSlider.normalizedValue); //Changes the health bar colour based on the character's HP
         if (gameObject.tag == "Player")
         {
             accessCC.IncrementEHitCounter();
             workingObj = GameObject.FindGameObjectWithTag("Enemy");
             workingObj.GetComponent <SpecialAttackControl>().IncrementSpecialValue(10);
         }
         if (gameObject.tag == "Enemy")
         {
             accessCC.IncrementPHitCounter();
             workingObj = GameObject.FindGameObjectWithTag("Player");
             workingObj.GetComponent <SpecialAttackControl>().IncrementSpecialValue(10);
         }
     }
 }