public void Dying() { Destroy(GetComponent <Rigidbody>()); StopCoroutine(colorChanger); StopCoroutine(stabCycle); if (alive) { if (!invulnerable) { healthBarHandler.Translate(); } if (gotWeapon) { playerInterface.Translate(); } GameSettings.ChangeHurtIndicator(hurtIndicator, colors[11], colors[8]); } else { GameSettings.ChangeHurtIndicator(hurtIndicator, colors[8]); GameChallenges.HandleEvent(GameChallenges.EventTypes.enemyKilled); Destroy(enemy.gameObject); } // dying animation Destroy(this); }
private void GameOver() { enemy.Lost(); if (!invulnerable) { healthBarHandler.Translate(); } if (gotWeapon) { playerInterface.Translate(); } GameSettings.ChangeHurtIndicator(hurtIndicator, colors[8]); //launch win animation Destroy(enemy.gameObject); Destroy(this); }
private IEnumerator MonsterDying() { enemy.Dying(); alive = false; if (!invulnerable) { healthBarHandler.Translate(); } if (gotWeapon) { playerInterface.Translate(); } GameSettings.ChangeHurtIndicator(hurtIndicator, colors[8]); yield return(new WaitForSeconds(2f)); //launch win animation GameChallenges.HandleEvent(GameChallenges.EventTypes.enemyKilled); Destroy(enemy.gameObject); Destroy(this); }