Photon Unity Networking 2 2.45

Static Public Member Functions | List of all members
PhotonTeamExtensions Class Reference

Extension methods for the Player class that make use of PhotonTeamsManager. More...

Static Public Member Functions

static PhotonTeam GetPhotonTeam (this Player player)
 Gets the team the player is currently joined to. Null if none. More...
 
static bool JoinTeam (this Player player, PhotonTeam team)
 Join a team. More...
 
static bool JoinTeam (this Player player, byte teamCode)
 Join a team using team code. More...
 
static bool JoinTeam (this Player player, string teamName)
 Join a team using team name. More...
 
static bool SwitchTeam (this Player player, PhotonTeam team)
 Switch that player's team to the one you assign. More...
 
static bool SwitchTeam (this Player player, byte teamCode)
 Switch the player's team using a team code. More...
 
static bool SwitchTeam (this Player player, string teamName)
 Switch the player's team using a team name. More...
 
static bool LeaveCurrentTeam (this Player player)
 Leave the current team if any. More...
 
static bool TryGetTeamMates (this Player player, out Player[] teamMates)
 Try to get the team mates. More...
 

Detailed Description

Extension methods for the Player class that make use of PhotonTeamsManager.

Member Function Documentation

◆ GetPhotonTeam()

static PhotonTeam GetPhotonTeam ( this Player  player)
static

Gets the team the player is currently joined to. Null if none.

Returns
The team the player is currently joined to. Null if none.

◆ JoinTeam() [1/3]

static bool JoinTeam ( this Player  player,
byte  teamCode 
)
static

Join a team using team code.

Parameters
playerThe player who will join the team.
teamCodeThe code fo the team to be joined.
Returns

◆ JoinTeam() [2/3]

static bool JoinTeam ( this Player  player,
PhotonTeam  team 
)
static

Join a team.

Parameters
playerThe player who will join a team.
teamThe team to be joined.
Returns

◆ JoinTeam() [3/3]

static bool JoinTeam ( this Player  player,
string  teamName 
)
static

Join a team using team name.

Parameters
playerThe player who will join the team.
teamNameThe name of the team to be joined.
Returns

◆ LeaveCurrentTeam()

static bool LeaveCurrentTeam ( this Player  player)
static

Leave the current team if any.

Parameters
player
Returns
If the leaving team request is queued to be sent to the server or done in case offline or not joined to a room yet.

◆ SwitchTeam() [1/3]

static bool SwitchTeam ( this Player  player,
byte  teamCode 
)
static

Switch the player's team using a team code.

Internally checks if this player is in that team already or not.

Parameters
playerThe player that will switch teams.
teamCodeThe code of the team to switch to.
Returns
If the team switch request is queued to be sent to the server or done in case offline or not joined to a room yet.

◆ SwitchTeam() [2/3]

static bool SwitchTeam ( this Player  player,
PhotonTeam  team 
)
static

Switch that player's team to the one you assign.

Internally checks if this player is in that team already or not. Only team switches are actually sent.

Parameters
player
team

◆ SwitchTeam() [3/3]

static bool SwitchTeam ( this Player  player,
string  teamName 
)
static

Switch the player's team using a team name.

Internally checks if this player is in that team already or not.

Parameters
playerThe player that will switch teams.
teamNameThe name of the team to switch to.
Returns
If the team switch request is queued to be sent to the server or done in case offline or not joined to a room yet.

◆ TryGetTeamMates()

static bool TryGetTeamMates ( this Player  player,
out Player[]  teamMates 
)
static

Try to get the team mates.

Parameters
playerThe player to get the team mates of.
teamMatesThe team mates array to fill.
Returns
If successful or not.