BomberUnits
...a Unity learning project
RemotePlayer Class Reference

A Player is one participant in a game. More...

+ Inheritance diagram for RemotePlayer:
+ Collaboration diagram for RemotePlayer:

Classes

class  RemoteClient
 

Public Member Functions

override bool IsLocal ()
 Helper to make the many queries for a player being local more readable.
 
override NetData GetNetData ()
 Implementation for remote players needs fetching from the NetAdapter.
 
override void FreeResourcesAndRemove ()
 Removes this player from the tracked instance list. More...
 
override string ToString ()
 
- Public Member Functions inherited from Player
bool HasFigure ()
 
PlayerController GetCtrl ()
 This getter shortens the access to a player's controller and thus player figure status.
 
string GetClientId ()
 
string GetName ()
 
ColorScheme GetColor ()
 
PlayerFigurePrefab GetPrefab ()
 
State GetState ()
 
void UpdateMultiple (NetData newNetData)
 Interface to update multiple net dat content at once. More...
 
void OnNetDataChange (NetData newNetData)
 This ensures actions on changing networked data are taken, such as player resource usage.
 
override string ToString ()
 

Static Public Member Functions

static new void Awake ()
 
static new List< RemotePlayerGetAll ()
 This is quite costly! Do not use in update cycles! This method hides the GetAll method of Player. More...
 
static new bool Contains (string clientId, int uid)
 Returns whether client and uid are listed as a remote player.
 
static new RemotePlayer Get (string clientId, int uid)
 Warning messages are already logged by the GetClient and RemoteClient.GetPlayer methods, so they are not repeated here. More...
 
static bool HasClient (string clientId)
 
static RemoteClient GetClient (string clientId)
 
static Dictionary< string, RemoteClientGetAllClients ()
 
static Dictionary< int, RemotePlayerGetPlayersOfClient (string clientId)
 
static RemotePlayer CreateNew (string clientId, int uid, NetData netData)
 
static void CreateNewForWholeClient (string clientId)
 Creates one local RemotePlayer for each entry found for this clientId.
 
static new int Count ()
 
- Static Public Member Functions inherited from Player
static void Awake ()
 Player is no MonoBehaviour, so this has to be called from playerManager during startup.
 
static bool Contains (string clientId, int uid)
 
static Player Get (string clientId, int uid)
 
static Dictionary< int, PlayerGetAll ()
 
static int Count ()
 

Private Member Functions

 RemotePlayer (string clientId, int uid, NetData netData)
 Inaccessible Constructor: no need to publish network data, as it is already present.
 

Static Private Attributes

static Dictionary< string, RemoteClientremoteClients
 

Additional Inherited Members

- Public Types inherited from Player
enum  State : short { notPlaying = 0, playing = 1, ready = 2 }
 Holds current state of this player here, so it is not bound to any specific go (player figure).
 
- Public Attributes inherited from Player
readonly int uid
 
GameObject playerFigure
 
Vector3 spawnLoc
 
- Protected Member Functions inherited from Player
 Player (string clientId, int uid, NetData netData)
 Constructor is only called from concrete subclasses. More...
 
- Protected Attributes inherited from Player
string clientId
 

Detailed Description

A Player is one participant in a game.

There may be multiple players playing from one client. This wraps all player information needed for the Lobby and in-game. It does not currently contain match information! This is tracked by the figure controller. Packed Net format: [0]: string clientID [1]: int UID [2]: string name [3]: Type player type (local or remote) [4]: int color scheme Key [5]: int player figure prefab Key [6]: int input scheme Key Note: a valid spawn position is indicated by the value being different than negative infinity!

Definition at line 23 of file RemotePlayer.cs.

Member Function Documentation

◆ FreeResourcesAndRemove()

override void FreeResourcesAndRemove ( )
inlinevirtual

Removes this player from the tracked instance list.

Also removes the whole client if no players are left for it.

Reimplemented from Player.

Definition at line 193 of file RemotePlayer.cs.

◆ Get()

static new RemotePlayer Get ( string  clientId,
int  uid 
)
inlinestatic

Warning messages are already logged by the GetClient and RemoteClient.GetPlayer methods, so they are not repeated here.

Definition at line 102 of file RemotePlayer.cs.

◆ GetAll()

static new List<RemotePlayer> GetAll ( )
inlinestatic

This is quite costly! Do not use in update cycles! This method hides the GetAll method of Player.

Definition at line 77 of file RemotePlayer.cs.


The documentation for this class was generated from the following file: