void Restart() { int level = PlayerAdaptiveInfo.getCurrLevel(); //SceneManager.LoadScene (SceneManager.GetActiveScene().name); SceneManager.LoadScene(level); }
public void EndGame(string reason) { if (!isGameEnded) { Debug.Log("End reason : " + reason); PlayerAdaptiveInfo.IncreaseRestartCount(); Attempts attempt = new Attempts(); attempt.Completed = false; attempt.FailureType = reason; attempt.Level = PlayerAdaptiveInfo.getCurrLevel(); attempt.SessionId = PlayerStats.SessionDetails.SessionId; attempt.SideForce = PlayerAdaptiveInfo.adaptiveInfo.sideForce; attempt.Speed = PlayerAdaptiveInfo.adaptiveInfo.currSpeed; PlayerStats.AddAttemptData(attempt); if (reason.Equals(COLLISION)) { PlayerAdaptiveInfo.IncreaseCollisionCount(); } PlayerAdaptiveInfo.adjustSpeedOrLevel(); Debug.Log("Game Over"); isGameEnded = true; Invoke("Restart", restartDelay); //Restart (); } }