C# Class PhotonPlayer, PaperCowboys

Summarizes a "player" within a room, identified (in that room) by actorID.
Each player has a actorID, valid for that room. It's -1 until it's assigned by server.
Mostrar archivo Open project: Gamieon/PaperCowboys Class Usage Examples

Public Properties

Property Type Description
isLocal bool

Public Methods

Method Description
Equals ( object p ) : bool

Makes PhotonPlayer comparable

Find ( int ID ) : PhotonPlayer,

Try to get a specific player by id.

GetHashCode ( ) : int
PhotonPlayer ( bool isLocal, int actorID, string name ) : System.Collections

Creates a PhotonPlayer instance.

SetCustomProperties ( Hashtable propertiesToSet ) : void

Updates and synchronizes the named properties of this Player with the values of propertiesToSet.

Any player's properties are available in a Room only and only until the player disconnect or leaves. Access any player's properties by: Player.CustomProperties (read-only!) but don't modify that hashtable. New properties are added, existing values are updated. Other values will not be changed, so only provide values that changed or are new. To delete a named (custom) property of this player, use null as value. Only string-typed keys are applied (everything else is ignored). Local cache is updated immediately, other players are updated through Photon with a fitting operation. To reduce network traffic, set only values that actually changed.

ToString ( ) : string

Gives the name.

Protected Methods

Method Description
PhotonPlayer ( bool isLocal, int actorID, Hashtable properties ) : System.Collections

Internally used to create players from event Join

Private Methods

Method Description
InternalCacheProperties ( Hashtable properties ) : void

Caches custom properties for this player.

InternalChangeLocalID ( int newID ) : void

Used internally, to update this client's playerID when assigned.

Method Details

Equals() public method

Makes PhotonPlayer comparable
public Equals ( object p ) : bool
p object
return bool

Find() public static method

Try to get a specific player by id.
public static Find ( int ID ) : PhotonPlayer,
ID int ActorID
return PhotonPlayer,

GetHashCode() public method

public GetHashCode ( ) : int
return int

PhotonPlayer() protected method

Internally used to create players from event Join
protected PhotonPlayer ( bool isLocal, int actorID, Hashtable properties ) : System.Collections
isLocal bool
actorID int
properties Hashtable
return System.Collections

PhotonPlayer() public method

Creates a PhotonPlayer instance.
public PhotonPlayer ( bool isLocal, int actorID, string name ) : System.Collections
isLocal bool If this is the local peer's player (or a remote one).
actorID int ID or ActorNumber of this player in the current room (a shortcut to identify each player in room)
name string Name of the player (a "well known property").
return System.Collections

SetCustomProperties() public method

Updates and synchronizes the named properties of this Player with the values of propertiesToSet.
Any player's properties are available in a Room only and only until the player disconnect or leaves. Access any player's properties by: Player.CustomProperties (read-only!) but don't modify that hashtable. New properties are added, existing values are updated. Other values will not be changed, so only provide values that changed or are new. To delete a named (custom) property of this player, use null as value. Only string-typed keys are applied (everything else is ignored). Local cache is updated immediately, other players are updated through Photon with a fitting operation. To reduce network traffic, set only values that actually changed.
public SetCustomProperties ( Hashtable propertiesToSet ) : void
propertiesToSet Hashtable Hashtable of props to udpate, set and sync. See description.
return void

ToString() public method

Gives the name.
public ToString ( ) : string
return string

Property Details

isLocal public_oe property

Only one player is controlled by each client. Others are not local.
public bool isLocal
return bool