// DEBUG: These are just for testing menu flow public void OnSettingsClicked() { clickSound.Play(); //gameSetShown = true; CloseSet(); SetManager.OpenSet <SettingsSet>(); }
public void OnBackButtonClicked() { introLoaded = true; clickSound.Play(); CloseSet(); SetManager.OpenSet <MainMenuSet>(); }
// DEBUG: These are just for testing menu flow public void OnBackButtonClicked() { clickSound.Play(); // Levels.CloseLevel(); CloseSet(); SetManager.OpenSet <MainMenuSet>(); }
public void NextActiveSet(string setName) { if (newSet != null) { newSet.CloseSet(); } switch (setName) { case "Intro": newSet = SetManager.OpenSet <SplashIntroSet>(); break; case "Main Menu": newSet = SetManager.OpenSet <MainMenuSet>(); break; case "Tutorial": newSet = SetManager.OpenSet <TutorialSet>(); break; case "Game Set": newSet = SetManager.OpenSet <GamePanelSet>(); break; case "Summary": newSet = SetManager.OpenSet <SummarySet>(); break; } newSet.transform.SetParent(Holder.transform, false); }
private void Update() { if (!movie.isPlaying) { Game.Inst.levelSelect = SetManager.OpenSet <LevelSelectionSet>((lss) => Game.Inst.WantsToBeInWaitState = true); Destroy(gameObject); } }
// DEBUG: These are just for testing menu flow public void OnHelpClicked() { clickSound.Play(); Debug.Log("AUDIO"); //gameSetShown = true; CloseSet(); SetManager.OpenSet <HelpSet>(); }
public void OnPlayClicked() { // clickSound.Play(); CloseSet(); gameRunNow = true; SetManager.OpenSet <GameSet>(); // gameSetShown = true; }
public void OnExitGame() { Game.Inst.WantsToBeInWaitState = true; // Levels.CloseLevel(); CloseSet(); SetManager.OpenSet <MainMenuSet>(); }
public void OnSettingsClicked() { clickSound.Play(); Game.Inst.WantsToBeInWaitState = true; // Levels.CloseLevel(); CloseSet(); SetManager.OpenSet <MainMenuSet>(); }
//Lose Sequence when player is killed IEnumerator LoseSequence() { yield return(new WaitForSeconds(1f)); // Game.Inst.WantsToBeInWaitState = true; CloseSet(); SetManager.OpenSet <LoseSet>(); playerIsDead = true; yield return(new WaitForSeconds(3f)); Levels.CloseLevel(); }
public void BackToLevelSelect() { PlayerHealth.currentHealth = PlayerHealth.maxHealth; playerScript.playerAnim.SetBool("Dead", false); playerScript.playerAnim.SetBool("Idle", true); PlayerHealth.reset = false; GameObject[] sceneGO = FindObjectsOfType <GameObject>(); foreach (GameObject obj in sceneGO) { if (obj.tag != "GameController") { Destroy(obj); } } Game.Inst.levelSelect = SetManager.OpenSet <LevelSelectionSet>(); Game.Inst.dataManager.levelSelected = 0; Game.Inst.CurrentState = GameState.GAME_WAITING; Pausing(); }
public void Update() { // Don't update the game if the app is not running if (!App.Inst.GetIsRunning()) { return; } // Main game STATE MACHINE switch (CurrentState) { case GameState.GAME_INITIALIZING: // TODO: Add all of your initialization logic here // play splash screen // loading data if any dataManager = SetManager.OpenSet <DataManagerSet>(); GameObject splashIntro = ResourceManager.Create("Prefab/Misc/SplashIntro"); splashIntro.transform.position = Vector3.zero; WantsToBeInWaitState = true; // If we want to be in the wait state, do the state transition if (WantsToBeInWaitState) { DoStateTransition(GameState.GAME_WAITING); } break; case GameState.GAME_WAITING: // TODO: Go into this state and do nothing until the game is ready to run (for instance on the main menu or on the win/lose screens) // If we want to be in the loading state, do the state transition if (WantsToBeInLoadingState) { DoStateTransition(GameState.GAME_LOADING); } break; case GameState.GAME_LOADING: // TODO: Load the level hud = SetManager.OpenSet <HUDSet>(); levelManager = SetManager.OpenSet <LevelManager>(); levelManager.LoadLevel(); WantsToBeInRunningState = true; // If we want to be in the running state, do the state transition if (WantsToBeInRunningState) { DoStateTransition(GameState.GAME_RUNNING); } break; case GameState.GAME_RUNNING: // TODO: This is wher ethe majority of the game logic will happen and there might even be sub-states within this main game state // If we want to pause the game, go into the pause game state if (WantsToBeInWaitState) { DoStateTransition(GameState.GAME_WAITING); } break; default: Debug.Assert(false, "Invalid CurrentState for GameState in Game.cs"); break; } }
public void Update() { // Don't update the game if the app is not running if (!App.Inst.GetIsRunning()) { return; } // Main game STATE MACHINE switch (CurrentState) { case GameState.GAME_INITIALIZING: // TODO: Add all of your initialization logic here // Load all of your data DataLoader.LoadData(); // Load main menu set SetManager.OpenSet <MainMenuSet>((mms) => WantsToBeInWaitState = true); // If we want to be in the wait state, do the state transition if (WantsToBeInWaitState) { DoStateTransition(GameState.GAME_WAITING); } break; case GameState.GAME_WAITING: // TODO: Go into this state and do nothing until the game is ready to run (for instance on the main menu or on the win/lose screens) // If we want to be in the loading state, do the state transition if (WantsToBeInLoadingState) { DoStateTransition(GameState.GAME_LOADING); } break; case GameState.GAME_LOADING: // TODO: Load the level WantsToBeInRunningState = true; // If we want to be in the running state, do the state transition if (WantsToBeInRunningState) { randomizeLevels(); } DoStateTransition(GameState.GAME_RUNNING); break; case GameState.GAME_RUNNING: // TODO: This is wher ethe majority of the game logic will happen and there might even be sub-states within this main game state // If we want to pause the game, go into the pause game state if (WantsToBeInWaitState) { DoStateTransition(GameState.GAME_WAITING); } break; default: Debug.Assert(false, "Invalid CurrentState for GameState in Game.cs"); break; } // Reload the game if (Input.GetKeyDown(KeyCode.R)) { SceneManager.LoadScene("Boot"); Levels.CurrentLevelNumber = 1; } }
public void OnPlayAgainClicked() { CloseSet(); SetManager.OpenSet <MainMenuSet>(); }
void Update() { switch (CurrentState) { case GameState.INIT: // setting up all managers and game datas uiSetManager = SetManager.OpenSet <UISetManager>(); soundManager = ResourcesManager.Create("Prefab/SoundManager").GetComponent <SoundManager>(); uiSetManager.NextActiveSet("Intro"); bool FileExist = File.Exists(Application.persistentDataPath + "bcgame.dat"); if (FileExist) { NewData = new Data(); NewData = SaveData.LoadData <Data>("bcgame.dat"); HighestRoundCompleted = NewData.Round; IsTutorialComplete = NewData.IsTutorialComplete; } BCGame.IsogramWords = LoadWordsList.GetWordsFile(); GameIsWaiting = true; if (GameIsWaiting) { ChangeState(GameState.WAITING); } break; case GameState.WAITING: // waiting for input from player, reset gameplay LevelTime = 300; BCGame.CurrentRound = 1; bool UserInput = Input.anyKey; TimeToQuit -= Time.deltaTime; if (TimeToQuit <= 0) { App.Inst.Quit(); } else if (UserInput && TimeToQuit > 0) { TimeToQuit = 120f; } if (GameIsLoading) { ChangeState(GameState.LOADING); } break; case GameState.LOADING: // get neccessary datas for the game to start PlayGame(); uiSetManager.NextActiveSet("Game Set"); if (GameIsRunning) { ChangeState(GameState.RUNNING); } break; case GameState.RUNNING: // check if win or lose, save data if (IsRoundStarted) { LevelTime -= Time.deltaTime; bool bRoundIncomplete = BCGame.GetCurrentTry() > BCGame.GetMaxTry(); if (bRoundIncomplete || LevelTime < 0) { IsRoundStarted = false; uiSetManager.NextActiveSet("Summary"); soundManager.PlayWinLose(!bRoundIncomplete); ChangeState(GameState.WAITING); } } if (GameIsLoading) { ChangeState(GameState.LOADING); } else if (GameIsWaiting) { ChangeState(GameState.WAITING); } break; } if (Input.GetKeyDown(KeyCode.Space)) { print(BCGame.MyHiddenWord); } }