public void ApplyDamage(float damage) { // if we died don't execute the rest of the code if (is_Dead) { return; } if (is_Player) { current_health -= damage; //player_script.playerHurt(); } if (is_Scarab) { enemy_script.Damaged(); current_health -= damage; } // Vemos si es boss y si no está haciendo alguno de sus ataques para quitarle vida if (is_Boss && !boss_Anim.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("Smash Attack") && !boss_Anim.GetAnim().GetCurrentAnimatorStateInfo(0).IsName("Stab Attack")) { boss_Anim.TakeDamage(); current_health -= damage; } if (current_health <= 0f) { if (is_Player) { Cursor.lockState = CursorLockMode.None; StartCoroutine(changeGameOverScene("gameOver")); } if (is_Scarab) { enemy_script.Dead(); } if (is_Boss) { Debug.Log("BOSS DIES"); StartCoroutine(changeGameOverScene("victory")); boss_Anim.Die(); } is_Dead = true; } }
private void OnDieAction(Action onDieAnimationComplete) { m_BossAnimator.Die(onDieAnimationComplete); m_CurrentTimer = Time.time; }