コード例 #1
0
    /// <summary>
    /// Plays job intro
    /// </summary>
    public IEnumerator PlayJobIntro()
    {
        yield return(new WaitUntil(() => SceneManager.GetSceneByName("Interface_Runtime").isLoaded));

        progressBar = FindObjectOfType <ProgressBarUI>();

        chatting = false;
        while (currentJob == null)
        {
            yield return(null);
        }

        //check for an introduction "event"
        GameObject intro = (from introEvent in currentJob.introEvents
                            let requirements = introEvent.GetComponent <InkDriverBase>().requiredStats
                                               where HasRequiredStats(requirements, introEvent.GetComponent <InkDriverBase>().isScalableEvent) select introEvent).FirstOrDefault();

        if (intro != null)
        {
            // Load Event_General Scene for upcoming event
            asm.LoadSceneSeperate("Event_NoChoices");
            yield return(new WaitUntil(() => SceneManager.GetSceneByName("Event_NoChoices").isLoaded));

            CreateEvent(intro);
        }
        else
        {
            print("Found nothing in currentJob");
        }

        //Go to the travel coroutine
        travelCoroutine = StartCoroutine(Travel());
    }
コード例 #2
0
 public void StartMiniGame(string miniGame)
 {
     if (currentMiniGame != null)
     {
         return;
     }
     buttonMenu.SetActive(false);
     returnButton.SetActive(true);
     currentMiniGame = miniGame;
     additiveSceneManager.LoadSceneSeperate(miniGame);
 }
コード例 #3
0
    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");
    }
コード例 #4
0
    /// <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;
        }
    }