// Start is called before the first frame update
 void Start()
 {
     teamManager           = FindObjectOfType <TeamManager>();
     PLayersOnPoint        = new List <string>();
     pv                    = GetComponent <PhotonView>();
     controlpointText.text = "noone on point";
     punTeams              = FindObjectOfType <PunTeams>();
 }
示例#2
0
    void Start()
    {
        photonView = GetComponent <PhotonView> ();
        messages   = new Queue <string> (messageCount);

        PhotonNetwork.logLevel = PhotonLogLevel.Full;
        PhotonNetwork.ConnectUsingSettings("1.0");
        StartCoroutine("UpdateConnectionString");

        punTeams = GetComponent <PunTeams>();
    }
示例#3
0
    /// <summary>Switch that player's team to the one you assign.</summary>
    /// <remarks>Internally checks if this player is in that team already or not. Only team switches are actually sent.</remarks>
    /// <param name="player"></param>
    /// <param name="team"></param>
    public static void SetTeam(this PhotonPlayer player, PunTeams.Team team)
    {
        if (!PhotonNetwork.connectedAndReady)
        {
            Debug.LogWarning("JoinTeam was called in state: " + PhotonNetwork.connectionStateDetailed + ". Not connectedAndReady.");
        }

        PunTeams.Team currentTeam = PhotonNetwork.player.GetTeam();
        if (currentTeam != team)
        {
            PhotonNetwork.player.SetCustomProperties(new Hashtable() {{PunTeams.TeamPlayerProp, (byte) team}});
        }
    }
示例#4
0
 // Start is called before the first frame update
 void Start()
 {
     pv             = GetComponent <PhotonView>();
     team1text.text = team2text.text = string.Empty;
     punTeams       = GetComponent <PunTeams>();
 }
示例#5
0
    public void SwitchTeams( PunTeams.Team prefTeam = PunTeams.Team.none )
    {
        int CurrentTeam = ( int )PhotonNetwork.player.GetTeam( );

        if ( prefTeam == PunTeams.Team.none )
        {
            CurrentTeam++;

            if ( CurrentTeam > 4 )
            {
                CurrentTeam = 0;
            }

            //Skip none
            if ( CurrentTeam == 0 || ( PunTeams.Team )CurrentTeam == PunTeams.Team.none )
                CurrentTeam++;
        }
        else
        {
            CurrentTeam = ( int )prefTeam;
        }

        //Set this player's team
        PhotonNetwork.player.SetTeam( ( PunTeams.Team )CurrentTeam );
    }