// 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);
    }
    // MonoBehaviour's interface

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

        // Get AI Factory component.

        m_AIFactoryComponent = GetComponent <tnStandardMatchAIFactoryComponent>();

        // UI

        if (m_InstructionsPanelPrefab != null)
        {
            tnPanel_StandardMatchInstructions instructionsPanelInstance = Instantiate <tnPanel_StandardMatchInstructions>(m_InstructionsPanelPrefab);
            instructionsPanelInstance.transform.SetParent(transform);

            m_InstructionsPanel = instructionsPanelInstance;
        }

        if (m_CelebrationPanelPrefab != null)
        {
            tnPanel_Celebration celebrationPanelInstance = Instantiate <tnPanel_Celebration>(m_CelebrationPanelPrefab);
            celebrationPanelInstance.transform.SetParent(transform);

            m_CelebrationPanel = celebrationPanelInstance;
        }

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

            m_FlatBackgroundPanel = flatBackgroundPanelInstance;
        }

        if (m_StandardMatchResultsPanelPrefab != null)
        {
            tnPanel_StandardMatchResults standardMatchResultsPanelInstance = Instantiate <tnPanel_StandardMatchResults>(m_StandardMatchResultsPanelPrefab);
            standardMatchResultsPanelInstance.transform.SetParent(transform);

            m_StandardMatchResultsPanel = standardMatchResultsPanelInstance;
        }

        if (m_StandardMatchStatsPanelPrefab != null)
        {
            tnPanel_StandardMatchStats standardMatchStatsPanelInstance = Instantiate <tnPanel_StandardMatchStats>(m_StandardMatchStatsPanelPrefab);
            standardMatchStatsPanelInstance.transform.SetParent(transform);

            m_StandardMatchStatsPanel = standardMatchStatsPanelInstance;
        }
    }
Example #3
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);
    }