private void DoStumble(GameObject obstacle, StumbleLocation location) { if (disableStumpleOnTrackBorders == true) { if (location == StumbleLocation.LeftTrackBorder) { return; } if (location == StumbleLocation.RightTrackBorder) { return; } } camera.Shake(); bool gameOver = false; if (GameGlobals.isInCriticalState == false) { StartCoroutine(GameGlobals.Instance.CriticalState(GameGlobals.Instance.criticalStateSeconds)); GameGlobals.Instance.PlayerPlaySound("PlayerStumple"); GameGlobals.Instance.PlayerPlaySound("ouch"); doAnEffect(EffetcType.StumplePuff); print(location); switch (location) { case StumbleLocation.FrontLower: // Jump and passable objects gameOver = true; break; case StumbleLocation.FrontMiddle: // -- Game Over gameOver = true; break; case StumbleLocation.FrontUpper: // -- Game Over gameOver = true; break; case StumbleLocation.LeftSide: gameOver = false; break; case StumbleLocation.RightSide: gameOver = false; break; case StumbleLocation.LeftTrackBorder: gameOver = false; break; case StumbleLocation.RightTrackBorder: gameOver = false; break; case StumbleLocation.FrontLeftCorner: gameOver = false; break; case StumbleLocation.FrontRightCorner: gameOver = false; break; case StumbleLocation.BackLeftCorner: gameOver = false; break; case StumbleLocation.BackRightCorner: gameOver = false; break; } } else if (GameGlobals.isInCriticalState == true) { gameOver = true; } if (gameOver == true) { StopAllCoroutines(); isGameOver = true; playerAnimator.Play("death", 0, 0); doAnEffect(EffetcType.DeathPuff); GameGlobals.Instance.PlayerPlaySound("ouch"); GameGlobals.Instance.PlayerPlaySound("death"); GameGlobals.Instance.GameOver(); //doGameOver(obstacle); } }
private void DoStumble(GameObject obstacle, StumbleLocation location) { if (GameGlobals.Instance.isInGamePlay() == false) { return; } // Tutorial Handler -------------------------> //GameGlobals.Instance.cameraController.Shake(); if (PlayerPrefs.GetInt("tutorial", 0) == 0) { tutorialLastZ = player.transform.position.z; doAnEffect(EffetcType.DeathPuff); GameGlobals.Instance.playerController.SetActive(false); GameGlobals.Instance.audioController.playSound("PlayerStumple", false); GameGlobals.Instance.audioController.playSound("PlayerOuch4", false); GameGlobals.Instance.audioController.stopSound("PlayerFootSteps", false); GameGlobals.Instance.cameraController.Shake(); GameGlobals.Instance.audioController.playSoundDelayed("UIError", false, 0.5f); if (TutorialController.instance != null) { TutorialController.instance.hideMessagePanel(); TutorialController.instance.hideHand(); TutorialController.instance.showMessage("Let's try it again !", 1); } if (GameGlobals.Instance.isInGamePlay() == true) { StartCoroutine(tutorialRestart()); } return; } // Tutorial Handler -------------------------> if (disableStumpleOnTrackBorders == true) { if (location == StumbleLocation.LeftTrackBorder) { return; } if (location == StumbleLocation.RightTrackBorder) { return; } } bool isInCriticalState = false; if (CriticalModeController.Instance.currentState == CriticalModeController.CriticalModeState.onEnter) { isInCriticalState = true; } else { isInCriticalState = false; } //string collidedObstacleID = getObstacleTrackObjectID(obstacle); GameGlobals.Instance.cameraController.Shake(); playVillainAnimation("run"); bool gameOver = false; if (isInCriticalState == false) { if (onStumple != null) { onStumple.Invoke(); } GameGlobals.Instance.audioController.playSound("PlayerStumple", false); GameGlobals.Instance.audioController.playRandomOuch(); doAnEffect(EffetcType.StumplePuff); switch (location) { case StumbleLocation.FrontLower: // Jump and passable objects gameOver = true; break; case StumbleLocation.FrontMiddle: // -- Game Over gameOver = true; break; case StumbleLocation.FrontUpper: // -- Game Over gameOver = true; break; case StumbleLocation.LeftSide: gameOver = false; break; case StumbleLocation.RightSide: gameOver = false; break; case StumbleLocation.LeftTrackBorder: gameOver = false; break; case StumbleLocation.RightTrackBorder: gameOver = false; break; case StumbleLocation.FrontLeftCorner: gameOver = false; break; case StumbleLocation.FrontRightCorner: gameOver = false; break; case StumbleLocation.BackLeftCorner: gameOver = false; break; case StumbleLocation.BackRightCorner: gameOver = false; break; } } else if (isInCriticalState == true) { gameOver = true; } gameOver = false; if (gameOver == true) { doAnEffect(EffetcType.DeathPuff); GameGlobals.Instance.audioController.playSound("PlayerOuch4", false); GameGlobals.Instance.audioController.playSound("PlayerDeath", false); doGameOver(obstacle); } }