// MonoBehaviour's interface

    protected override void Awake()
    {
        base.Awake();

        // Get Component.

        m_ObjectPoolController = GetComponent <ObjectPoolController>();

        // UI

        if (m_CountdownPanelPrefab != null)
        {
            tnPanel_Countdown countdownPanel = Instantiate <tnPanel_Countdown>(m_CountdownPanelPrefab);
            countdownPanel.transform.SetParent(transform, true);

            m_CountdownPanel = countdownPanel;
        }

        if (m_EndGamePanelPrefab != null)
        {
            tnPanel_EndGame endGamePanel = Instantiate <tnPanel_EndGame>(m_EndGamePanelPrefab);
            endGamePanel.transform.SetParent(transform, true);

            m_EndGamePanel = endGamePanel;
        }

        if (m_FlatBackgroundPanelPrefab != null)
        {
            tnPanel_FlatBackground flatBackgroundPanel = Instantiate <tnPanel_FlatBackground>(m_FlatBackgroundPanelPrefab);
            flatBackgroundPanel.transform.SetParent(transform, true);

            m_FlatBackgroundPanel = flatBackgroundPanel;
        }

        if (m_PauseMenuPanelPrefab != null)
        {
            tnPanel_PauseMenu pauseMenuPanel = Instantiate <tnPanel_PauseMenu>(m_PauseMenuPanelPrefab);
            pauseMenuPanel.transform.SetParent(transform, true);

            m_PauseMenuPanel = pauseMenuPanel;
        }

        if (m_InGameOptionsPanelPrefab != null)
        {
            tnPanel_InGameOptions inGameOptionsPanel = Instantiate <tnPanel_InGameOptions>(m_InGameOptionsPanelPrefab);
            inGameOptionsPanel.transform.SetParent(transform, true);

            m_InGameOptionsPanel = inGameOptionsPanel;
        }

        m_LoadingPanel = GameObjectUtils.FindObjectWithTag <UIController>(s_Loading_Tag);
    }
Exemplo n.º 2
0
    // MonoBehaviour's interface

    protected override void Awake()
    {
        base.Awake();

        // Add players to process request handler.

        PhotonPlayer[] photonPlayers = PhotonNetwork.playerList;
        for (int photonPlayerIndex = 0; photonPlayerIndex < photonPlayers.Length; ++photonPlayerIndex)
        {
            PhotonPlayer photonPlayer   = photonPlayers[photonPlayerIndex];
            int          photonPlayerId = photonPlayer.ID;
            m_ProceedRequestHandler.AddPlayer(photonPlayerId);
        }

        // Get component.

        m_PhotonView           = GetComponent <PhotonView>();
        m_ObjectPoolController = GetComponent <ObjectPoolController>();

        // UI

        if (m_CountdownPanelPrefab != null)
        {
            tnPanel_Countdown countdownPanel = Instantiate <tnPanel_Countdown>(m_CountdownPanelPrefab);
            countdownPanel.transform.SetParent(transform, true);

            m_CountdownPanel = countdownPanel;
        }

        if (m_EndGamePanelPrefab != null)
        {
            tnPanel_EndGame endGamePanel = Instantiate <tnPanel_EndGame>(m_EndGamePanelPrefab);
            endGamePanel.transform.SetParent(transform, true);

            m_EndGamePanel = endGamePanel;
        }

        if (m_DialogPanelPrefab != null)
        {
            tnPanel_Dialog dialogPanel = Instantiate <tnPanel_Dialog>(m_DialogPanelPrefab);
            dialogPanel.transform.SetParent(transform, true);

            m_DialogPanel = dialogPanel;
        }

        if (m_FlatBackgroundPanelPrefab != null)
        {
            tnPanel_FlatBackground flatBackgroundPanel = Instantiate <tnPanel_FlatBackground>(m_FlatBackgroundPanelPrefab);
            flatBackgroundPanel.transform.SetParent(transform, true);

            m_FlatBackgroundPanel = flatBackgroundPanel;
        }

        if (m_PauseMenuPanelPrefab != null)
        {
            tnPanel_PauseMenu pauseMenuPanel = Instantiate <tnPanel_PauseMenu>(m_PauseMenuPanelPrefab);
            pauseMenuPanel.transform.SetParent(transform, true);

            m_PauseMenuPanel = pauseMenuPanel;
        }

        if (m_InGameOptionsPanelPrefab != null)
        {
            tnPanel_InGameOptions inGameOptionsPanel = Instantiate <tnPanel_InGameOptions>(m_InGameOptionsPanelPrefab);
            inGameOptionsPanel.transform.SetParent(transform, true);

            m_InGameOptionsPanel = inGameOptionsPanel;
        }

        m_LoadingPanel = GameObjectUtils.FindObjectWithTag <UIController>(s_Loading_Tag);
    }