コード例 #1
0
    /// <summary>
    /// Creates and initializes the shared objects.
    /// </summary>
    private void CreateSharedObjects()
    {
        m_faderUI  = CreateSharedUIFromPrefab <FaderUI>(FADER_UI_PREFAB_PATH);
        m_timerUI  = CreateSharedUIFromPrefab <TimerUI>(TIMER_UI_PREFAB_PATH);
        m_pauseUI  = CreateSharedUIFromPrefab <PauseUI>(PAUSE_UI_PREFAB_PATH);
        m_scoreUI  = CreateSharedUIFromPrefab <ScoreUI>(SCORE_UI_PREFAB_PATH);
        m_fasterUI = CreateSharedUIFromPrefab <FasterUI>(FASTER_UI_PREFAB_PATH);

        m_faderUI.transform.SetPosZ(-100000.0f);                // Instantiate outside camera view
        DontDestroyOnLoad(m_faderUI.gameObject);
        m_faderUI.Initialize();                                 // Hide (shared UI start hidden)
        m_faderUI.transform.SetPosZ(0.0f);                      // Restore position once hidden

        m_timerUI.transform.SetPosZ(-100000.0f);
        DontDestroyOnLoad(m_timerUI.gameObject);
        m_timerUI.Initialize();
        m_timerUI.transform.SetPosZ(0.0f);

        m_pauseUI.transform.SetPosZ(-100000.0f);
        DontDestroyOnLoad(m_pauseUI.gameObject);
        m_pauseUI.Initialize();
        m_pauseUI.transform.SetPosZ(0.0f);

        m_scoreUI.transform.SetPosZ(-100000.0f);
        DontDestroyOnLoad(m_scoreUI.gameObject);
        m_scoreUI.Initialize();
        m_scoreUI.transform.SetPosZ(0.0f);

        m_fasterUI.transform.SetPosZ(-100000.0f);
        DontDestroyOnLoad(m_fasterUI.gameObject);
        m_fasterUI.Initialize();
        m_fasterUI.transform.SetPosZ(0.0f);

        m_timerUI.Hide();
        m_pauseUI.Hide();
        m_scoreUI.Hide();
        m_fasterUI.Hide();
    }