protected override IEnumerator SoloModeRestart() { if (PlayerPrefabs.Count() <= 0) { yield break; } if (LevelCameraController != null) { LevelCameraController.FollowsPlayer = false; } yield return(new WaitForSeconds(RespawnDelay)); if (LevelCameraController != null) { LevelCameraController.FollowsPlayer = true; } //if (CurrentCheckPoint != null) { //CurrentCheckPoint.SpawnPlayer(Players[0]); //} _started = DateTime.UtcNow; gameOverGUI.SetActive(true); // we send a new points event for the GameManager to catch (and other classes that may listen to it too) //MMEventManager.TriggerEvent(new CorgiEnginePointsEvent(PointsMethods.Set, _savedPoints)); // we trigger a respawn event //MMEventManager.TriggerEvent(new CorgiEngineEvent(CorgiEngineEventTypes.Respawn)); }
/// <summary> /// Coroutine that kills the player, stops the camera, resets the points. /// </summary> /// <returns>The player co.</returns> protected IEnumerator SoloModeRestart(Character player, Transform respawnPoint, Character.FacingDirections facingDirection) { if ((PlayerPrefabs.Count() <= 0) && (SceneCharacters.Count <= 0)) { yield break; } MMCameraEvent.Trigger(MMCameraEventTypes.StopFollowing); CharacterSwapManager.DisableSwap(); yield return(new WaitForSeconds(RespawnDelay)); CharacterSwapManager.EnableSwap(); // if we've setup our game manager to use lives (meaning our max lives is more than zero) if (GameManager.Instance.MaximumLives > 0) { int lastCurrentLives = GameManager.Instance.CurrentLives; // we lose a life GameManager.Instance.LoseLife(); Config.currentLives = GameManager.Instance.CurrentLives; var currentLives = GameManager.Instance.CurrentLives; //nếu đang ở level không cho phép hồi sinh dưới 0 mạng if (Config.currentSceneIndex > Config.UNLIMIT_LIVE_LEVEL) { //nếu âm mạng hoặc mạng đang bằng 0 từ đầu ván thì ending //còn nếu mạng về 0 thì vẫn cho chơi nốt một lần if (currentLives < 0 || (currentLives == 0 && lastCurrentLives == 0)) { StickmanManager.Instance.ShowRevivePanel(); yield return(new WaitUntil(() => !StickmanManager.Instance.isWaitToRevive)); yield return(null); } } } MMCameraEvent.Trigger(MMCameraEventTypes.StartFollowing); player.RespawnAt(respawnPoint, facingDirection); _started = DateTime.UtcNow; // we send a new points event for the GameManager to catch (and other classes that may listen to it too) CorgiEnginePointsEvent.Trigger(PointsMethods.Set, 0); // we trigger a respawn event ResetLevelBoundsToOriginalBounds(); CorgiEngineEvent.Trigger(CorgiEngineEventTypes.Respawn); }