Class Player
Represents a player in multiplayer.
There are no players in singleplayer.
Assembly: Assembly-CSharp.dll
Syntax
Properties
ActivePrefab
The entity type the player has selected in the level editor.
Can be null if the player is not actively using the level editor.
Declaration
public EntityPrefabInfo ActivePrefab { get; }
Property Value
InLocalSim
Whether this player is currently in local simulation mode.
Declaration
public bool InLocalSim { get; }
Property Value
InternalObject
Internal representation of this object.
WARNING: This is not part of the stable API and subject to change!
Declaration
public PlayerData InternalObject { get; }
Property Value
Type |
Description |
PlayerData |
|
IsHost
Whether this is the host of the current multiplayer session.
Declaration
public bool IsHost { get; }
Property Value
IsLocalPlayer
Whether this is the local player.
Declaration
public bool IsLocalPlayer { get; }
Property Value
IsSpectator
Whether this player is a spectator.
Declaration
public bool IsSpectator { get; }
Property Value
Machine
The machine of this player (if it's not a spectator).
Declaration
public PlayerMachine Machine { get; }
Property Value
Name
Declaration
public string Name { get; }
Property Value
NetworkId
ID of the player used for network communications.
Declaration
public ushort NetworkId { get; }
Property Value
Ping
Declaration
Property Value
Selection
What entities the local player has selected in the level editor.
If this is not the local player, null.
Declaration
public ReadOnlyCollection<Entity> Selection { get; }
Property Value
SteamId
SteamID of the player.
Empty if not connected via Steam.
Declaration
public string SteamId { get; }
Property Value
Team
What team this player is a part of.
Declaration
public MPTeam Team { get; }
Property Value
VoteState
Whether this player has voted to start simulation.
Declaration
public bool VoteState { get; }
Property Value
Methods
Equals(Player)
Declaration
protected bool Equals(Player other)
Parameters
Type |
Name |
Description |
Player |
other |
|
Returns
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
Overrides
From(PlayerData)
Create a Player object from its internal representation.
Declaration
public static Player From(PlayerData data)
Parameters
Type |
Name |
Description |
PlayerData |
data |
|
Returns
From(UInt16)
Returns a Player object from its network id.
Declaration
public static Player From(ushort networkId)
Parameters
Type |
Name |
Description |
UInt16 |
networkId |
|
Returns
GetAllPlayers()
Get a list of players currently connected.
Declaration
public static List<Player> GetAllPlayers()
Returns
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
GetHost()
Returns a Player object representing the host of the current
multiplayer session.
Declaration
public static Player GetHost()
Returns
GetLocalPlayer()
Returns a Player object representing the local player.
Can be null when in singleplayer.
Declaration
public static Player GetLocalPlayer()
Returns
ToString()
Declaration
public override string ToString()
Returns
Overrides
Operators
Equality(Player, Player)
Declaration
public static bool operator ==(Player left, Player right)
Parameters
Returns
Inequality(Player, Player)
Declaration
public static bool operator !=(Player left, Player right)
Parameters
Returns