Exemplo n.º 1
0
    private void Awake()
    {
        PhotonNetwork.AutomaticallySyncScene = true;

        activePanel = askUsernamePanel;
        instance    = this;
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        // find lobby manager
        if (lobbyManager == null)
        {
            lobbyManager = FindObjectOfType <OnlineLobbyManager>();
        }

        // update player names
        UpdatePlayerNameText();

        // update player wins
        UpdateWins();
    }
Exemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        // finds online manager.
        if (lobbyManager == null)
        {
            lobbyManager = FindObjectOfType <OnlineLobbyManager>();
        }


        // looks for host object
        if (hostObject == null)
        {
            GameObject.Find("Host");
        }

        // looks for join object.
        if (joinObject == null)
        {
            GameObject.Find("Host");
        }
    }
Exemplo n.º 4
0
    // exists the lobby.
    public void ExitLobby()
    {
        // game builder to be deleted.
        GameBuilder gb = null;

        // if the lobby manager has not been set, try looking for it.
        if (lobbyManager == null)
        {
            lobbyManager = FindObjectOfType <OnlineLobbyManager>();
        }

        // destroys online manager upon exit.
        if (lobbyManager != null)
        {
            // gets the game builder from the lobby manager.
            gb = lobbyManager.gameBuilder;

            Destroy(lobbyManager.gameObject);
        }


        // searches for the game builder if the lobby manager didn't have it.
        if (gb == null)
        {
            gb = FindObjectOfType <GameBuilder>();
        }

        // if the game builder is not equal to null.
        if (gb != null)
        {
            Destroy(gb.gameObject);
        }


        // changes the scene.
        SceneChanger.ChangeScene(exitScene);
    }
Exemplo n.º 5
0
    // Start is called before the first frame update
    void Start()
    {
        // lobby manager
        if (lobbyManager == null)
        {
            lobbyManager = FindObjectOfType <OnlineLobbyManager>();
        }

        // looks for host button
        if (hostButton == null)
        {
            GameObject go = GameObject.Find("Host Button");

            // finds the button attached to the host button
            if (go != null)
            {
                hostButton = go.GetComponent <Button>();
            }
        }

        // Room Code InputField
        if (roomCodeInputField == null)
        {
            // searches for object.
            GameObject temp = GameObject.Find("Room Join Code InputField");

            // object found
            if (temp != null)
            {
                roomCodeInputField = temp.GetComponent <InputField>();
            }
        }

        // room indicator colour
        if (roomIndict == null)
        {
            GameObject temp = GameObject.Find("Room Join Status");
            roomIndict = temp.GetComponent <Image>();
        }

        // room indicator found.
        if (roomIndict != null)
        {
            // gets 'off' colour.
            roomIndictOff = roomIndict.color;

            // this not set.
            if (roomIndictOn == Color.black)
            {
                roomIndictOn = roomIndictOff;
            }
        }


        // player name text labels
        // player 1
        if (hostLabel == null)
        {
            GameObject temp = GameObject.Find("Host Name Text");

            // gets text
            if (temp != null)
            {
                hostLabel = temp.GetComponent <Text>();
            }
        }

        // player 2
        if (join1Label == null)
        {
            GameObject temp = GameObject.Find("Join 1 Name Text");

            // gets text
            if (temp != null)
            {
                join1Label = temp.GetComponent <Text>();
            }
        }

        // player 3
        if (join2Label == null)
        {
            GameObject temp = GameObject.Find("Join 2 Name Text");

            // gets text
            if (temp != null)
            {
                join2Label = temp.GetComponent <Text>();
            }
        }

        // player 4
        if (join3Label == null)
        {
            GameObject temp = GameObject.Find("Join 3 Name Text");

            // gets text
            if (temp != null)
            {
                join3Label = temp.GetComponent <Text>();
            }
        }
    }
Exemplo n.º 6
0
    // public GameObject hostPane;
    // public GameObject join1Pane;
    // public GameObject join2Pane;
    // public GameObject join3Pane;

    // Start is called before the first frame update
    void Start()
    {
        // lobby manager
        if (lobbyManager == null)
        {
            lobbyManager = FindObjectOfType <OnlineLobbyManager>();
        }

        // looks for join button
        if (joinButton == null)
        {
            GameObject go = GameObject.Find("Join Button");

            // finds the button attached to the host button
            if (go != null)
            {
                joinButton = go.GetComponent <Button>();
            }
        }

        // Room Code InputField
        if (roomCodeInputField == null)
        {
            // searches for object.
            GameObject temp = GameObject.Find("Room Host Code InputField");

            // object found
            if (temp != null)
            {
                roomCodeInputField = temp.GetComponent <InputField>();
            }
        }

        // room size text not set.
        if (roomSizeText == null)
        {
            // search for object.
            GameObject temp = GameObject.Find("Room Size Text");

            // get text component.
            if (temp != null)
            {
                roomSizeText = temp.GetComponent <Text>();
            }
        }

        // room size slider
        if (roomSizeSlider == null)
        {
            // search for object.
            GameObject temp = GameObject.Find("Room Size Slider");

            // get text component.
            if (temp != null)
            {
                roomSizeSlider = temp.GetComponent <Slider>();
            }
        }

        // gets the room size in integer form.
        if (roomSizeText != null)
        {
            lobbyManager.roomSize = int.Parse(roomSizeText.text);
        }


        // room indicator colour
        if (roomIndict == null)
        {
            GameObject temp = GameObject.Find("Room Open Status");
            roomIndict = temp.GetComponent <Image>();
        }

        // room indicator found.
        if (roomIndict != null)
        {
            // gets 'off' colour.
            roomIndictOff = roomIndict.color;

            // this not set.
            if (roomIndictOn == Color.black)
            {
                roomIndictOn = roomIndictOff;
            }
        }


        // gets the time dropdown
        if (timeSelect == null)
        {
            // searches for object.
            GameObject temp = GameObject.Find("Time Dropdown");

            // gets component
            if (temp != null)
            {
                timeSelect = temp.GetComponent <Dropdown>();
            }

            // sets the start time
            if (timeSelect != null)
            {
                SetStartTime();
            }
        }

        // SCORE
        // score text
        if (scoreText == null)
        {
            GameObject newObject = GameObject.Find("Win Score Text");
            scoreText = newObject.GetComponent <Text>();
        }

        // gets the score value
        if (scoreSelect == null)
        {
            // searches for object.
            GameObject temp = GameObject.Find("Win Score Slider");

            // gets component
            if (temp != null)
            {
                scoreSelect = temp.GetComponent <Slider>();
            }

            // sets the starting score
            if (scoreSelect != null)
            {
                OnScoreChange();
            }
        }

        // if the start button is set to null.
        if (startButton == null)
        {
            GameObject temp = GameObject.Find("Start Button");

            // finds the start button
            if (temp != null)
            {
                startButton = temp.GetComponent <Button>();
            }
        }

        // player names
        UpdatePlayerNameText();
    }