![]() |
BomberUnits
...a Unity learning project
|
A Player is one participant in a game. More...
Inheritance diagram for Player:
Collaboration diagram for Player:Classes | |
| class | UnityStringIntEvent |
Public Types | |
| 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 Member Functions | |
| abstract bool | IsLocal () |
| Helper to make the many queries for a player being local more readable. | |
| virtual void | FreeResourcesAndRemove () |
| Removes this instance from the tracking list. More... | |
| abstract NetData | GetNetData () |
| Returns a copy(!) of the currently held NetData of this Player. More... | |
| 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 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, Player > | GetAll () |
| static int | Count () |
Public Attributes | |
| readonly int | uid |
| GameObject | playerFigure |
| Vector3 | spawnLoc |
Protected Member Functions | |
| Player (string clientId, int uid, NetData netData) | |
| Constructor is only called from concrete subclasses. More... | |
Protected Attributes | |
| string | clientId |
Private Attributes | |
| int | colorDictKeyBackup |
| Copy to be able to compare incoming changes. | |
Static Private Attributes | |
| static Dictionary< int, Player > | players |
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.
|
inlinevirtual |
Removes this instance from the tracking list.
This is extended with additional steps in the Player subclasses, to be called by instances. At this point, the player's net data is most likely not available -> use backups for the resources.
Reimplemented in RemotePlayer, and LocalPlayer.
|
pure virtual |
Returns a copy(!) of the currently held NetData of this Player.
Whether a server request or local shortcut can be used is implemented by the concrete classes.
Implemented in RemotePlayer, and LocalPlayer.
|
inline |