void Start() { gameState = FindObjectOfType<GameState>(); if (gameState == null) { Debug.LogError("GameState Object not found in scene!"); Destroy(this.gameObject); } levelInProgress = false; StartLevel(); }
public void Lose() { UI.Menu.MenuManager.StateTransition(Assets.Scripts.UI.Menu.MenuManager.MenuState.NoStateOverride, Assets.Scripts.UI.Menu.MenuManager.MenuState.Lose); _state = GameState.Lose; if(GamePause != null) GamePause(); }
public static void Load(string _level) { _state = GameState.Loading; LoadingScreen.LevelToLoad = _level; LoadingScreen._instance.LoadNextLevel(); }
public static void FinishedLoading() { _state = GameState.Running; }
void Update() { if(_shouldPause && !IsPaused) { _state = GameState.Paused; if(GamePause != null) GamePause(); } if(!_shouldPause && IsPaused) { _state = GameState.Running; if(GameUnpause != null) GameUnpause(); } if (Input.GetKeyDown(KeyCode.F)) { RestartGame(); } }
void Awake() { if(_instance == null) { DontDestroyOnLoad(this.gameObject); _instance = this; } else if(_instance != this) { Destroy(this.gameObject); } // BeginGame(); _state = GameState.Running; }