IEnumerator LoadGameOver(Unity.LEGO.Game.DeathEvent evt) { Destroy(GameObject.Instantiate(deathEffect, evt.player.transform.position, evt.player.transform.rotation), 2f); yield return(new WaitForSeconds(2f)); SceneManager.LoadScene("GameOver"); }
IEnumerator RespawnCoroutine(Unity.LEGO.Game.DeathEvent evt) { Destroy(GameObject.Instantiate(deathEffect, evt.player.transform.position, evt.player.transform.rotation), 2f); yield return(new WaitForSeconds(respawnTime)); evt.player.GetComponent <HealthController>().OnRespawn(); evt.player.GetComponent <Unity.LEGO.Minifig.MinifigController>().Respawn(LastSafezone.GetLastSafePosition()); }
void OnPlayerDeath(Unity.LEGO.Game.DeathEvent evt) { if (oneLife) { // Trigger game win event Unity.LEGO.Game.Events.GameOverEvent.Win = true; Unity.LEGO.Game.EventManager.Broadcast(Unity.LEGO.Game.Events.GameOverEvent); StartCoroutine(LoadGameOver(evt)); } else { StartCoroutine(RespawnCoroutine(evt)); } }