/// <summary> /// This function is called when the player dies /// </summary> public void Die() { OnPlayerDies?.Invoke(); score.CheckRecord(); cam.transform.parent = null; rb.isKinematic = false; canMove = false; StartCoroutine(RestartGame()); //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); }
private void Start() { _player.SetOnDeath(() => OnPlayerDies.Invoke(_player.HasRevived())); _player.SetOnRevive(() => { _enemies.ForEach(Destroy); _enemies.Clear(); }); OnGameInitialized.Invoke(); }