IEnumerator StartGame()
    {
        // skip all actions until next frame
        yield return(null);

        // enable main menu panel (it was disabled by ChooseChapter)
        MainMenuManager.Instance.MainMenuPanel.SetActive(true);
        // Disable Choose Chapter menu
        MainMenuManager.Instance.ChooseChapter.gameObject.SetActive(false);
        // Load currently set active chapter
        ChapterManager.Instance.LoadChapter(ChapterManager.Instance.ActiveChapter.ChapterData.chapterName);
        // change player name to the name which is set by the user
        TurnsManager.Instance.GetActivePlayer().PlayerData.givenName = GetPlayerName();
        // get selected faction
        Faction selectedFaction = factionSelectionGroup.GetSelectedFaction();

        // Activate and reset turns manager, set chosen faction as active player
        TurnsManager.Instance.Reset(selectedFaction);
        // Activate main menu in game mode
        MainMenuManager.Instance.MainMenuInGameModeSetActive(true);
        // Activate world map
        ChapterManager.Instance.ActiveChapter.GetComponentInChildren <MapManager>(true).gameObject.SetActive(true);
        // Set chosen Unique ability for chosen player
        // TurnsManager.Instance.GetActivePlayer().PlayerData.playerUniqueAbilityData.uniqueAbilityConfig = Array.Find(ConfigManager.Instance.UniqueAbilityConfigsMap, element => element.playerUniqueAbility == playerUniqueAbility).uniqueAbilityConfig;
        // Array.Find(ConfigManager.Instance.UniqueAbilityConfigs, element => element.playerUniqueAbility == playerUniqueAbility);
        TurnsManager.Instance.GetActivePlayer().PlayerData.playerUniqueAbilityData.playerUniqueAbility = uniqueAbilitiesToggleGroup.GetSelectedToggle().GetComponent <UniqueAbilitySelector>().UniqueAbilityConfig.playerUniqueAbility;
        // GetSelectedUnitType and Get Chosen race starting city and hire first hero
        transform.root.GetComponentInChildren <UIManager>().GetComponentInChildren <EditPartyScreen>(true).HireUnit(null, GetSelectedUnitType(), false, ObjectsManager.Instance.GetStartingCityByFaction(selectedFaction));
        // Wait a bit
        yield return(new WaitForSeconds(startGameConfig.startingScreenExplicitDelaySeconds));

        // Unblock mouse input
        InputBlocker.SetActive(false);
        // Deactivate Loading screen
        loadingScreen.SetActive(false);
        // Activate Prolog
        prolog.SetActive(true, ChapterManager.Instance.ActiveChapter.ChapterData);
        // [Should be last] Deactivate (this) Choose your first hero menu
        SetActive(false);
    }
Esempio n. 2
0
 public Color GetSelectedColor()
 {
     return(colorsToggleGroup.GetSelectedToggle().GetComponentInChildren <RawImage>().color);
 }