コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        teamSystem = FindObjectOfType <TeamSystem>();

        //when each button is pressed, change our team to that button's team and destroy this object
        Buttons[0].onClick.AddListener(delegate
        {
            teamSystem.ChangeTeam(Teams[0]);

            Cursor.visible   = false;
            Cursor.lockState = CursorLockMode.Locked;

            Destroy(gameObject);
        });
        //when each button is pressed, change our team to that button's team and destroy this object
        Buttons[1].onClick.AddListener(delegate
        {
            teamSystem.ChangeTeam(Teams[1]);

            Cursor.visible   = false;
            Cursor.lockState = CursorLockMode.Locked;

            Destroy(gameObject);
        });
    }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        teamSystem = FindObjectOfType <TeamSystem>();

        //iterate through all of the buttons
        for (int i = 0; i < Buttons.Length; i++)
        {
            //when each button is pressed, change our team to that button's team and destroy this object
            Buttons[i].onPress += () =>
            {
                teamSystem.ChangeTeam((TeamSystem.Team)i);
                Destroy(gameObject);
            };
        }
    }
コード例 #3
0
    public void PlayerSetup(int _clientID, TeamSystem.Team _team, string _name)
    {
        client     = FindObjectOfType <MultiClient>();
        ClientID   = _clientID;
        team       = _team;
        PlayerName = _name;

        nameText.text = PlayerName;

        LocalOwned = ClientID == client._ClientID;

        TeamSystem teamSystem = FindObjectOfType <TeamSystem>();

        if (teamSystem)
        {
            teamSystem.ChangeTeam(_team);
        }

#if UNITY_EDITOR
        Debug.Log(String.Format("Player {0} Spawned in {1}", ClientID, UnityEngine.SceneManagement.SceneManager.GetActiveScene().name));
#endif
    }