/// <summary> /// Ends the event that is currently running. /// If the max number of events has been reached, go to the ending /// </summary> public void ConcludeEvent() { InkDriverBase concludedEvent = eventInstance.GetComponent <InkDriverBase>(); concludedEvent.ClearUI(); bool isRegularEvent = !isCheatEvent; if (concludedEvent.isCharacterEvent) { isRegularEvent = false; chatting = false; eventInstance.GetComponent <CharacterEvent>().EndCharacterEvent(); } else if (concludedEvent.isMutinyEvent) { isRegularEvent = false; mutiny = false; } else { daysSinceChat++; //all normal events raise days since chat } AnalyticsManager.OnEventComplete(concludedEvent); Destroy(eventInstance); //Go back to travel scene asm.UnloadScene("Event_NoChoices"); asm.UnloadScene("Event_General"); asm.UnloadScene("Event_CharacterFocused"); AudioManager.instance.PlayMusicWithTransition("General Theme"); //reset for next event eventActive = false; tick.StartTickUpdate(); AudioManager.instance.PlayRadio(AudioManager.instance.currentStationId, true); //set up for the next regular event if (isRegularEvent) { tick.DaysSince = 0; // reset days since skippedToEvent = false; nextEventLockedIn = false; eventRollCounter = 0; timeBeforeEventCounter = 0; } if (overallEventIndex >= maxEvents) //Potentially end the job entirely if this is meant to be the final event { GameManager.instance.ChangeInGameState(InGameStates.JobPayment); } }
public void EndMiniGame() { if (currentMiniGame == null) { return; } buttonMenu.SetActive(true); returnButton.SetActive(false); additiveSceneManager.UnloadScene(currentMiniGame); currentMiniGame = null; }
public void OpenCloseCheats() { if (cheatModeActive) { cheatModeActive = false; Destroy(FindObjectOfType <CheatsMenu>().gameObject); asm.UnloadScene("Cheats"); } else { cheatModeActive = true; asm.LoadSceneMerged("Cheats"); } }
private void LevelUpRooms() { asm.UnloadScene("ShipBuilding"); if (!ShipBuildingBuyableRoom.cheatLevels) { ShipBuildingBuyableRoom.cheatLevels = true; } else { ShipBuildingBuyableRoom.cheatJob += 1; if (ShipBuildingBuyableRoom.cheatJob == 3) { ShipBuildingBuyableRoom.cheatJob = 0; } } Debug.Log("Level " + (ShipBuildingBuyableRoom.cheatJob + 1) + " Unlocked"); asm.LoadSceneSeperate("ShipBuilding"); }
/// <summary> /// Changes the current game state to the passed in game state. /// Uses the AdditiveSceneManager to Load/Unload scenes. /// </summary> /// <param name="state">The InGameStates state to transition to</param> public void ChangeInGameState(InGameStates state) { // Checks if the passed in state is the same as the current state. if (state == currentGameState) { return; } // Otherwise it sets the current state to the passed state. currentGameState = state; // Handles what scenes to Load/Unload using the AdditiveSceneManager, along with additional scene cleanup. switch (state) { case InGameStates.GameIntro: additiveSceneManager.LoadSceneSeperate("Event_NoChoices"); additiveSceneManager.LoadSceneSeperate("Game_Intro"); break; case InGameStates.JobSelect: // Loads Jobpicker for the player to pick their job // unload game intro additiveSceneManager.UnloadScene("Event_NoChoices"); additiveSceneManager.UnloadScene("Game_Intro"); // unload normal additiveSceneManager.UnloadScene("Interface_Runtime"); additiveSceneManager.UnloadScene("Interface_GameOver"); additiveSceneManager.UnloadScene("Interface_CrewPaymentScreen"); additiveSceneManager.UnloadScene("Interface_RoomUnlockScreen"); // save game stuffs (moved from crew payment) SaveGameState(); ship.SaveShipStats(); MoraleManager.instance.SaveMorale(); ship.cStats.SaveCharacterStats(); SavingLoadingManager.instance.SaveRooms(); additiveSceneManager.LoadSceneSeperate("Interface_JobList"); additiveSceneManager.LoadSceneSeperate("Starport BG"); jobManager.RefreshJobList(); break; case InGameStates.ShipBuilding: // Loads ShipBuilding for the player to edit their ship additiveSceneManager.UnloadScene("Interface_JobList"); additiveSceneManager.UnloadScene("Interface_Runtime"); additiveSceneManager.UnloadScene("Interface_GameOver"); additiveSceneManager.LoadSceneSeperate("Starport BG"); additiveSceneManager.LoadSceneSeperate("ShipBuilding"); additiveSceneManager.LoadSceneSeperate("CrewManagement"); SaveGameState(); break; case InGameStates.Events: // Unloads ShipBuilding and starts the Travel coroutine for the event system. additiveSceneManager.UnloadScene("Starport BG"); additiveSceneManager.UnloadScene("ShipBuilding"); additiveSceneManager.UnloadScene("CrewManagement"); additiveSceneManager.UnloadScene("Interface_GameOver"); // if loading from continue if (!FindObjectOfType <SpotChecker>()) { StartCoroutine(LoadSpotCheckerInShipBuilding()); } else // if coming from crew management { SaveGameState(); MoraleManager.instance.SaveMorale(); ship.cStats.SaveCharacterStats(); ship.SaveShipStats(); SavingLoadingManager.instance.SaveRooms(); } additiveSceneManager.LoadSceneSeperate("Interface_Runtime"); StartCoroutine(EventSystem.instance.PlayJobIntro()); break; case InGameStates.Mutiny: // Loads the when the player reaches a mutiny. case InGameStates.Death: // Loads the when the player reaches a death. additiveSceneManager.UnloadScene("Event_General"); additiveSceneManager.UnloadScene("Event_CharacterFocused"); additiveSceneManager.UnloadScene("Interface_Runtime"); additiveSceneManager.LoadSceneSeperate("Interface_GameOver"); break; case InGameStates.JobPayment: additiveSceneManager.UnloadScene("Event_General"); additiveSceneManager.UnloadScene("Event_CharacterFocused"); additiveSceneManager.UnloadScene("Interface_Runtime"); additiveSceneManager.LoadSceneSeperate("Interface_JobPaycheckScreen"); break; case InGameStates.CrewPayment: additiveSceneManager.UnloadScene("Interface_JobPaycheckScreen"); additiveSceneManager.LoadSceneSeperate("Interface_CrewPaymentScreen"); break; case InGameStates.RoomUnlock: additiveSceneManager.UnloadScene("Interface_CrewPaymentScreen"); additiveSceneManager.LoadSceneSeperate("Interface_RoomUnlockScreen"); break; case InGameStates.MoneyEnding: // Loads the PromptScreen_Money_End when the player reaches a narrative ending. additiveSceneManager.UnloadScene("Interface_CrewPaymentScreen"); additiveSceneManager.UnloadScene("Interface_RoomUnlockScreen"); additiveSceneManager.LoadSceneSeperate("Event_NoChoices"); additiveSceneManager.LoadSceneSeperate("PromptScreen_Money_End"); break; case InGameStates.MoraleEnding: // Loads the PromptScreen_Morale_End after the PromptScreen_Money_End. additiveSceneManager.UnloadScene("PromptScreen_Money_End"); additiveSceneManager.LoadSceneSeperate("PromptScreen_Morale_End"); break; case InGameStates.EndingStats: // Keeping only to not have errors, load into ending credits instead case InGameStates.EndingCredits: // Loads the Credits after the Interface_EndScreen_Stats. additiveSceneManager.UnloadScene("Event_NoChoices"); additiveSceneManager.UnloadScene("PromptScreen_Morale_End"); additiveSceneManager.LoadSceneSeperate("Credits"); break; default: // Output Warning when the passed in game state doesn't have a transition setup. Debug.LogWarning($"The passed in game state, {state.ToString()}, doesn't have a transition setup."); break; } }
/// <summary> /// Unloads this current minigame scene /// </summary> /// <param name="miniGame"></param> public void UnloadScene(MiniGameType miniGame) { overclocking = false; additiveSceneManager.UnloadScene(miniGame.ToString()); }