public void TakeDamage(int damage) { currentHealth = currentHealth - damage; healthBar.SetCurrentHealth(currentHealth); int rando = Random.Range(0, 2); if (rando == 1) { animatorHandler.PlayTargetAnimation("Damage", true); } else { animatorHandler.PlayTargetAnimation("Damage2", true); } if (currentHealth <= 0) { currentHealth = 0; if (rando == 1) { animatorHandler.PlayTargetAnimation("Death1", true); } else { animatorHandler.PlayTargetAnimation("Death2", true); } Destroy(this.gameObject.GetComponent <CharacterController> ()); Camera.main.transform.localPosition = new Vector3(0f, 2f, -0.90f); Camera.main.transform.localRotation = new Quaternion(90f, 0f, 0f, 0); Invoke("restart", 5); } }
public void HandleLightAttack(Weapon weapon) { int rando = Random.Range(0, 2); // if (rando == 1) { // animatorHandler.PlayTargetAnimation (weapon.Light_attack_1, true); // } else { animatorHandler.PlayTargetAnimation(weapon.Light_attack_2, true); // } }