Photon Fusion
2.1.1
Represents a Fusion player. More...
Inherits INetworkStruct.
Public Member Functions | |
| override readonly bool | Equals (object obj) |
| Determines whether the specified object is equal to the current object. | |
| readonly bool | Equals (PlayerRef other) |
| Determines whether the specified PlayerRef is equal to the current PlayerRef. | |
| override readonly int | GetHashCode () |
| Serves as the default hash function. | |
| override readonly string | ToString () |
| Returns a string that represents the current object. | |
Static Public Member Functions | |
| static PlayerRef | FromEncoded (int encoded) |
| Creates a new PlayerRef from the given encoded value. Same as FromRaw. | |
| static PlayerRef | FromIndex (int index) |
| Creates a new PlayerRef from the given index. | |
| static PlayerRef | FromRaw (int raw) |
| Creates a new PlayerRef from the given raw value. Same as FromEncoded. | |
| static bool | operator!= (PlayerRef a, PlayerRef b) |
| Determines whether two PlayerRef instances are not equal. | |
| static bool | operator== (PlayerRef a, PlayerRef b) |
| Determines whether two PlayerRef instances are equal. | |
| static unsafe PlayerRef | Read (NetBitBuffer *buffer) |
| Reads a PlayerRef from the provided NetBitBuffer. | |
| static unsafe void | Write (NetBitBuffer *buffer, PlayerRef playerRef) |
| Writes the PlayerRef to the provided NetBitBuffer. | |
| static unsafe void | Write< T > (T *buffer, PlayerRef playerRef) |
| Writes the PlayerRef to the provided buffer. | |
Static Public Attributes | |
| const int | MASTER_CLIENT_RAW = -1 |
| A constant representing the raw index value for the master client. | |
Properties | |
| readonly int | AsIndex [get] |
| Returns the PlayerRef int as an integer Id value. | |
| static IEqualityComparer< PlayerRef > | Comparer = new IndexEqualityComparer() [get] |
| Gets an equality comparer that can be used to compare two PlayerRef instances. | |
| static PlayerRef | InternalMasterClientIdentifier [get] |
| Special master client player ref value of -1. This is not a valid PlayerRef value in itself, and no Runner will ever be assigned this value as its LocalPlayer. It is used by properties like Object.StateAuthority to indicate that the MasterClient has authority To get the current master client PlayerRef use NetworkRunner.GetMasterClient. | |
| static PlayerRef | Invalid [get] |
| Invalid player ref. Used to differentiate no player ref (None) from an invalid one. | |
| readonly bool | IsInternalMasterClientIdentifier [get] |
| Returns true if this PlayerRef indicates the MasterClient rather than a specific Player by Index, This is a special flag value which has the encoded index value of -2 (internal raw backing value of -1). This is not a valid PlayerRef value in itself, and no Runner will ever be assigned this value as its LocalPlayer. It is used by properties like Object.StateAuthority to indicate that the MasterClient has authority (which ever player that currently is), rather than a specific Player. | |
| readonly bool | IsInvalid [get] |
| Returns true if this PlayerRef has an invalid value. | |
| readonly bool | IsMasterClient [get] |
| readonly bool | IsNone [get] |
| Returns true if the index value equals -1 (internal raw value of 0), indicating no player. | |
| readonly bool | IsRealPlayer [get] |
| If this player ref is a valid unique player index. | |
| static PlayerRef | MasterClient [get] |
| static PlayerRef | None [get] |
| None player. | |
| readonly int | PlayerId [get] |
| Returns the PlayerRef as an integer Id value. | |
| readonly int | RawEncoded [get] |
| Returns the index backing value without modification. Unlike AsIndex which returns the backing value - 1. | |
Represents a Fusion player.
The PlayerRef, in contrast to the player index, is 1-based. The reason is that default(PlayerRef) will return a "null/invalid" player ref struct for convenience. There are automatic cast operators that can cast an int into a PlayerRef.
| override readonly bool Equals | ( | object | obj | ) |
Determines whether the specified object is equal to the current object.
| obj | The object to compare with the current object. |
| readonly bool Equals | ( | PlayerRef | other | ) |
|
static |
|
static |
|
static |
|
static |
Reads a PlayerRef from the provided NetBitBuffer.
| buffer | The buffer to read from. |
|
static |
Writes the PlayerRef to the provided NetBitBuffer.
| buffer | The buffer to write to. |
| playerRef | The PlayerRef to write. |
Writes the PlayerRef to the provided buffer.
| T | The type of the buffer. Must be unmanaged and implement INetBitWriteStream. |
| buffer | The buffer to write to. |
| playerRef | The PlayerRef to write. |
| T | : | unmanaged | |
| T | : | INetBitWriteStream |
|
get |
Returns the PlayerRef int as an integer Id value.
-1=None -2=MasterClient >=0=PlayerId
|
get |
Returns the PlayerRef as an integer Id value.
-1=None -2=MasterClient
|
get |
Returns the index backing value without modification. Unlike AsIndex which returns the backing value - 1.
0=None -1=MasterClient >0=PlayerId