void instantiateControllers()
    {
        aiController       = GameObject.FindGameObjectWithTag("AIController").GetComponent <AIController>();
        waypointController = GameObject.FindGameObjectWithTag("WaypointController").GetComponent <WaypointController>();

        waypointController.createWaypoints(ammountOfWaypoints);
        aiController.createCars(ammountOfAi);

        guiController = GameObject.FindGameObjectWithTag("GUIController").GetComponent <GUIController>();

        inGameGuiController = GameObject.FindGameObjectWithTag("GUIController").GetComponent <InGameGUIController>();

        guiController.setProgram(ProgramObjectController.getProgram(), null);
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        m_audioSource = GetComponentInParent <AudioSource>();

        GameObject soundManagerObj = GameObject.FindGameObjectWithTag(GameConsts.TAG_SOUND_MANAGER);

        if (soundManagerObj != null)
        {
            m_soundManager = soundManagerObj.GetComponent <SoundManager>();
        }

        m_menuController = GetComponentInParent <InGameGUIController>();
        SetActive(m_menuController == null);
    }
Пример #3
0
        /// What to do when any players leave the room
        public virtual void OnPeersDisconnected(string[] participantIds)
        {
            foreach (string participantID in participantIds)
            {
                UILogger.Log("Player " + participantID + " has left.");
            }

            // we should also exit the room

            LeaveGame();

            // and we should bring up the disconnection dialog if we are in a game
            InGameGUIController gui = GameObject.FindObjectOfType <InGameGUIController>();

            if (gui != null)
            {
                // we are in a level
                gui.DisconnectionHandler();
                return;
            }

            // if that didn't work, maybe we are in the postgame menu! in which case,
            // we should let the menu controller know about the disconnection
            PostSubmissionMenuController menu = GameObject.FindObjectOfType <PostSubmissionMenuController> ();

            if (menu != null)
            {
                menu.OnDisconnect();
                return;
            }

            // hmm, if we're here, we much not be in a level yet,
            // which is unlikely. But, if that's the case, we have
            // to handle the transition ourselves
            SceneManager.LoadMainMenu();
        }