Exemplo n.º 1
0
    IEnumerator AsynchronousLoad()                                                                                                                                                                      // --> Load a scene (Pinball Table)
    {
        /*if(Loading_Screen){
         *      Loading_Screen.gameObject.SetActive(true);													// Activate the loading screen
         * }*/

        if (menuManager != null)
        {
            menuManager.GoToOtherPageWithHisNumber(10);
        }
        yield return(new WaitForEndOfFrame());

        AsyncOperation a = SceneManager.LoadSceneAsync(obj_MainMenu.SceneName[obj_MainMenu.CurrentScene]);                                      // Load a scene

        a.allowSceneActivation = false;                                                                                                         // Do not activated the loading until allowSceneActivation = true

        while (!a.isDone)
        {
            float progress = Mathf.Clamp01(a.progress / 0.9f);
            if (LoadingText)
            {
                LoadingText.text = "Loading " + (progress * 100).ToString("n0") + "%";
            }

            if (a.progress == 0.9f)                                                                                                                                                                                     // Loading completed
            {
                a.allowSceneActivation = true;
            }

            yield return(null);
        }
    }
Exemplo n.º 2
0
    //public bool multiplayer = false;

    // Use this for initialization
    void Awake()
    {
        #region
        PlayerPrefs.SetInt("WeAreOnTrack", 1);                                                                                                                                                  // This PlayerPrefs = 1 : allow to display race selection when player came back to main menu

        if (canvas_MainMenu &&
            inventoryItemList.inventoryItem[0].b_TestMode == false
            /*&& PlayerPrefs.GetInt ("TestMode") == 0 */
            && !b_TuningZone)                                                                                                                   // If we are not in test mode
        {
            canvas_MainMenu.GoToOtherPageWithHisNumber(7);                                                                                      // Display Loading_Page
        }
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        if (!PlayerPrefs.HasKey("PP_1_Desktop_Left"))                                                                                                                                           // If no Input have been setup, init inputs
        {
            DefaultInputsParameters();
        }

        if (countdown == null)                                                                                                                                                                                          // Access coundown gameobject component
        {
            if (gameObject.GetComponent <Countdown>())
            {
                countdown = GetComponent <Countdown> ();
            }
        }

        if (lapcounter == null)                                                                                                                                                                                         // Access coundown gameobject component
        {
            GameObject objLapCounter = GameObject.Find("StartLine_lapCounter");
            if (objLapCounter)
            {
                lapcounter = objLapCounter.GetComponent <LapCounter> ();
            }
        }

        if (                                                         /*PlayerPrefs.GetInt ("TestMode") == 1 */
            inventoryItemList.inventoryItem[0].b_TestMode == true && // --> Demo Mode is activated
            inventoryItemList != null)                               // --> Feedback on screen : to say that the game is in Test Mode
        {
            GameObject objTextModeTest = inventoryItemList.inventoryItem [0].Canvas_TestMode;
            if (objTextModeTest)
            {
                GameObject instance = Instantiate(objTextModeTest) as GameObject;
                instance.name = "Canvas_TestMode";
            }
        }
        #endregion
    }
Exemplo n.º 3
0
    void Awake()
    {
        if (PlayerPrefs.GetInt("WeAreOnTrack") == 1)                                                            // --> If player come from a circuit
        {
            menuManager.GoToOtherPageWithHisNumber(2);                                                          // Open trackSelection page when scene start
            eventSystem.SetSelectedGameObject(Case01_FirstSelectedGameObject);
        }
        else                                                                                                            // --> If scene start after the application launch
        {
            menuManager.GoToOtherPageWithHisNumber(0);                                                                  // Open Hub page when scene start
            eventSystem.SetSelectedGameObject(Case02_FirstSelectedGameObject);
        }
        PlayerPrefs.SetInt("WeAreOnTrack", 0);

        if (PlayerPrefs.GetString("Which_GameMode") == "TimeTrial")                             // --> Activate Leadeboard if TimeTrial Mode is activated
        {
            if (leaderboard)
            {
                leaderboard.SetActive(true);
            }
            if (leaderboardShadow)
            {
                leaderboardShadow.SetActive(true);
            }
            if (difficulty_01)
            {
                difficulty_01.SetActive(false);
            }
            if (difficulty_02)
            {
                difficulty_02.SetActive(false);
            }
            if (difficulty_03)
            {
                difficulty_03.SetActive(false);
            }
            if (difficulty_04)
            {
                difficulty_04.SetActive(false);
            }
        }
        else
        {
            if (leaderboard)
            {
                leaderboard.SetActive(false);
            }
            if (leaderboardShadow)
            {
                leaderboardShadow.SetActive(false);
            }
            if (difficulty_01)
            {
                difficulty_01.SetActive(true);
            }
            if (difficulty_02)
            {
                difficulty_02.SetActive(true);
            }
            if (difficulty_03)
            {
                difficulty_03.SetActive(true);
            }
            if (difficulty_04)
            {
                difficulty_04.SetActive(true);
            }
        }
    }
Exemplo n.º 4
0
    IEnumerator MCR_Init()
    {
        yield return(new WaitForEndOfFrame());


        championshipM.instance.currentTrackInTheList = 0;       // Init championship
        championshipM.instance.listScore.Clear();

        if (PlayerPrefs.GetInt("WeAreOnTrack") == 1)
        {                           // --> If player come from a circuit
            if (PlayerPrefs.GetString("Which_GameMode") == "OnlineMultiPlayer")
            {
                menuManager.GoToOtherPageWithHisNumber(0);                           // Open Hub page when scene start
                eventSystem.SetSelectedGameObject(Case02_FirstSelectedGameObject);
            }
            else if (PlayerPrefs.GetString("Which_GameMode") == "Championship")
            {
                menuManager.GoToOtherPageWithHisNumber(11);                           // Open Hub page when scene start
                //eventSystem.SetSelectedGameObject(Case03_FirstSelectedGameObject);
            }
            else// Arcade or Time Trial
            {
                menuManager.GoToOtherPageWithHisNumber(2);                          // Open trackSelection page when scene start
                eventSystem.SetSelectedGameObject(Case01_FirstSelectedGameObject);
            }
        }
        else
        {                                                               // --> If scene start after the application launch
            Debug.Log("Start On hub Menu");
            menuManager.GoToOtherPageWithHisNumber(0);                  // Open Hub page when scene start
            eventSystem.SetSelectedGameObject(Case02_FirstSelectedGameObject);
        }
        PlayerPrefs.SetInt("WeAreOnTrack", 0);

        if (PlayerPrefs.GetString("Which_GameMode") == "TimeTrial")
        {           // --> Activate Leadeboard if TimeTrial Mode is activated
            if (leaderboard)
            {
                leaderboard.SetActive(true);
            }
            if (leaderboardShadow)
            {
                leaderboardShadow.SetActive(true);
            }
            if (difficulty_01)
            {
                difficulty_01.SetActive(false);
            }
            if (difficulty_02)
            {
                difficulty_02.SetActive(false);
            }
            if (difficulty_03)
            {
                difficulty_03.SetActive(false);
            }
            if (difficulty_04)
            {
                difficulty_04.SetActive(false);
            }
        }
        else
        {
            if (leaderboard)
            {
                leaderboard.SetActive(false);
            }
            if (leaderboardShadow)
            {
                leaderboardShadow.SetActive(false);
            }
            if (difficulty_01)
            {
                difficulty_01.SetActive(true);
            }
            if (difficulty_02)
            {
                difficulty_02.SetActive(true);
            }
            if (difficulty_03)
            {
                difficulty_03.SetActive(true);
            }
            if (difficulty_04)
            {
                difficulty_04.SetActive(true);
            }
        }
        yield return(null);
    }