Created
November 24, 2017 21:00
-
-
Save anonymous/9ba4dca6fed5031611688fc98b659888 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class LevelManager : MonoBehaviour { | |
public float autoLoadNextLevelAfter; | |
private OptionsController optionsController; | |
void Start(){ | |
if (autoLoadNextLevelAfter <= 0) { | |
Debug.Log ("No autoLoad, got it"); | |
} else { | |
Invoke ("LoadNextLevel", autoLoadNextLevelAfter); | |
} | |
} | |
public void LoadLevel(string name){ | |
Debug.Log ("Level load requested for: " + name); | |
Application.LoadLevel(name); | |
} | |
public void LoadSurvivalLevel (string name){ | |
optionsController = GameObject.Find("OptionsController").GetComponent<OptionsController>(); | |
if (optionsController.survivalSlider.value == 0f) { | |
Application.LoadLevel (Application.loadedLevel + 1); | |
} | |
else if (optionsController.survivalSlider.value == 1f) { | |
Application.LoadLevel ("04 Level_01 Survival"); | |
// Debug.LogError ("Survival mode is on!"); | |
} | |
SurvivalLoseCollider.livesSurvival = 10; | |
Debug.Log ("Level load requested for: " + name); | |
} | |
public void LoadNextLevel() { | |
Application.LoadLevel(Application.loadedLevel + 1); | |
} | |
public void QuitRequest(){ | |
Debug.Log ("I want to quit!"); | |
#if UNITY_EDITOR | |
UnityEditor.EditorApplication.isPlaying = false; | |
#else | |
Application.Quit(); | |
#endif | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment