private IEnumerator HpRegeneration() { yield return(new WaitForSeconds(10f)); healthBar.AdjustCurrentValue(hPRegen); StartCoroutine(HpRegeneration()); }
public void lifeSubstraction(int damage) { playerLives -= damage; GameManager.gm.playerHP -= damage; playerFire1.SetActive(true); fireAnim.Play("fire1"); if (playerLives < 2) { playerFire2.SetActive(true); fireAnim2.Play("fire1"); } playerAnimator.SetTrigger("Start Player hurt"); StartCoroutine(stopAnimationPlayerHurt()); HealthBar.AdjustCurrentValue(-1); }
void DamageToPlayer() { //Чтобы он не убивал нас будучи трупом if (checkDie_bot) { //Debug.Log(myName + "to player: DamageToPlayer();"); HealthBar.AdjustCurrentValue(-2); } //Если хп меньше 0 то сдохнет игрок if (HealthBar.currentValue <= 0 && PlayerController.checkDie) { PlayerController.checkDie = false; Debug.Log("Player: I am die..."); //Die(); } }
public void lifeSubstraction(int damage) { if (!_player.GetComponent <Player>().playerAnimator.GetCurrentAnimatorStateInfo(0).IsName("player hurt")) { GameManager.gm.playerHP -= damage; _player.GetComponent <Player>().playerFire1.SetActive(true); _player.GetComponent <Player>().fireAnim.Play("fire1"); if (playerHP < 2) { _player.GetComponent <Player>().playerFire2.SetActive(true); _player.GetComponent <Player>().fireAnim2.Play("fire1"); } if (playerHP > 0) { _player.GetComponent <Player>().playerAnimator.Play("player hurt"); StartCoroutine(_player.GetComponent <Player>().stopAnimationPlayerHurt()); } HealthBar.AdjustCurrentValue(-damage); } }