Photon Unity Networking 2 2.30

Public Member Functions | Static Public Attributes | Properties | Events | List of all members
PhotonTeamsManager Class Reference

Implements teams in a room/game with help of player properties. Access them by Player.GetTeam extension. More...

Inherits MonoBehaviour, IMatchmakingCallbacks, and IInRoomCallbacks.

Public Member Functions

bool TryGetTeamByCode (byte code, out PhotonTeam team)
 Find a PhotonTeam using a team code. More...
 
bool TryGetTeamByName (string teamName, out PhotonTeam team)
 Find a PhotonTeam using a team name. More...
 
PhotonTeam[] GetAvailableTeams ()
 Gets all teams available. More...
 
bool TryGetTeamMembers (byte code, out Player[] members)
 Gets all players joined to a team using a team code. More...
 
bool TryGetTeamMembers (string teamName, out Player[] members)
 Gets all players joined to a team using a team name. More...
 
bool TryGetTeamMembers (PhotonTeam team, out Player[] members)
 Gets all players joined to a team. More...
 
bool TryGetTeamMatesOfPlayer (Player player, out Player[] teamMates)
 Gets all team mates of a player. More...
 
int GetTeamMembersCount (byte code)
 Gets the number of players in a team by team code. More...
 
int GetTeamMembersCount (string name)
 Gets the number of players in a team by team name. More...
 
int GetTeamMembersCount (PhotonTeam team)
 Gets the number of players in a team. More...
 

Static Public Attributes

const string TeamPlayerProp = "_pt"
 Defines the player custom property name to use for team affinity of "this" player. More...
 

Properties

static PhotonTeamsManager Instance [get]
 

Events

static Action< Player, PhotonTeamPlayerJoinedTeam
 
static Action< Player, PhotonTeamPlayerLeftTeam
 

Detailed Description

Implements teams in a room/game with help of player properties. Access them by Player.GetTeam extension.

Teams are defined by enum Team. Change this to get more / different teams. There are no rules when / if you can join a team. You could add this in JoinTeam or something.

Member Function Documentation

◆ GetAvailableTeams()

PhotonTeam [] GetAvailableTeams ( )

Gets all teams available.

Returns
Returns all teams available.

◆ GetTeamMembersCount() [1/3]

int GetTeamMembersCount ( byte  code)

Gets the number of players in a team by team code.

Parameters
codeUnique code of the team
Returns
Number of players joined to the team.

◆ GetTeamMembersCount() [2/3]

int GetTeamMembersCount ( PhotonTeam  team)

Gets the number of players in a team.

Parameters
teamThe team you want to know the size of
Returns
Number of players joined to the team.

◆ GetTeamMembersCount() [3/3]

int GetTeamMembersCount ( string  name)

Gets the number of players in a team by team name.

Parameters
nameUnique name of the team
Returns
Number of players joined to the team.

◆ TryGetTeamByCode()

bool TryGetTeamByCode ( byte  code,
out PhotonTeam  team 
)

Find a PhotonTeam using a team code.

Parameters
codeThe team code.
teamThe team to be assigned if found.
Returns
If successful or not.

◆ TryGetTeamByName()

bool TryGetTeamByName ( string  teamName,
out PhotonTeam  team 
)

Find a PhotonTeam using a team name.

Parameters
teamNameThe team name.
teamThe team to be assigned if found.
Returns
If successful or not.

◆ TryGetTeamMatesOfPlayer()

bool TryGetTeamMatesOfPlayer ( Player  player,
out Player[]  teamMates 
)

Gets all team mates of a player.

Parameters
playerThe player whose team mates will be searched.
teamMatesThe array of players to be filled.
Returns
If successful or not.

◆ TryGetTeamMembers() [1/3]

bool TryGetTeamMembers ( byte  code,
out Player[]  members 
)

Gets all players joined to a team using a team code.

Parameters
codeThe code of the team.
membersThe array of players to be filled.
Returns
If successful or not.

◆ TryGetTeamMembers() [2/3]

bool TryGetTeamMembers ( PhotonTeam  team,
out Player[]  members 
)

Gets all players joined to a team.

Parameters
teamThe team which will be used to find players.
membersThe array of players to be filled.
Returns
If successful or not.

◆ TryGetTeamMembers() [3/3]

bool TryGetTeamMembers ( string  teamName,
out Player[]  members 
)

Gets all players joined to a team using a team name.

Parameters
teamNameThe name of the team.
membersThe array of players to be filled.
Returns
If successful or not.

Member Data Documentation

◆ TeamPlayerProp

const string TeamPlayerProp = "_pt"
static

Defines the player custom property name to use for team affinity of "this" player.