is an example of an object that can move around and update its position to clients in the system.
|
Public Types |
| enum | PlayerType {
PlayerTypeAI,
PlayerTypeAIDummy,
PlayerTypeClient,
PlayerTypeMyClient
} |
| | Enumeration of possible player types in the game. More...
|
| enum | MaskBits {
InitialMask = (1 << 0),
PositionMask = (1 << 1)
} |
| | Mask bits used for determining which object states need to be updated to all the clients. More...
|
Public Member Functions |
| | Player (PlayerType pt=PlayerTypeClient) |
| | Player constructor, assigns a random position in the playing field to the player, and if it is AI controlled will pick a first destination point.
|
| | ~Player () |
| | Player destructor removes the player from the game.
|
| void | performScopeQuery (TNL::GhostConnection *connection) |
| | performScopeQuery is called to determine which objects are "in scope" for the client that controls this Player instance.
|
| TNL::U32 | packUpdate (TNL::GhostConnection *connection, TNL::U32 updateMask, TNL::BitStream *stream) |
| | packUpdate writes the Player's ghost update from the server to the client.
|
| void | unpackUpdate (TNL::GhostConnection *connection, TNL::BitStream *stream) |
| | unpackUpdate reads the data the server wrote in packUpdate from the packet.
|
| void | serverSetPosition (Position startPos, Position endPos, TNL::F32 t, TNL::F32 tDelta) |
| | serverSetPosition is called on the server when it receives notice from a client to change the position of the player it controls.
|
| void | update (TNL::F32 timeDelta) |
| | Move this object along its path.
|
| void | onGhostAvailable (TNL::GhostConnection *theConnection) |
| | onGhostAvailable is called on the server when it knows that this Player has been constructed on the specified client as a result of being "in scope".
|
| bool | onGhostAdd (TNL::GhostConnection *theConnection) |
| | onGhostAdd is called for every NetObject on the client after the ghost has been constructed and its initial unpackUpdate is called.
|
| void | addToGame (TestGame *theGame) |
| | Adds this Player to the list of Player instances in the specified game.
|
| | TNL_DECLARE_RPC (rpcPlayerWillMove,(TNL::StringPtr testString)) |
| | rpcPlayerWillMove is used in TNLTest to demonstrate ghost->parent NetObject RPCs.
|
| | TNL_DECLARE_RPC (rpcPlayerDidMove,(TNL::Float< 6 > x, TNL::Float< 6 > y)) |
| | rpcPlayerDidMove is used in TNLTest to demostrate a broadcast RPC from the server to all of the ghosts on clients scoping this object.
|
| | TNL_DECLARE_RPC (rpcPlayerIsInScope,(TNL::Float< 6 > x, TNL::Float< 6 > y)) |
| | rpcPlayerIsInScope is the RPC method called by onGhostAvailable to demonstrate targeted NetObject RPCs.
|
| | TNL_DECLARE_CLASS (Player) |
| | This macro invocation declares the Player class to be known to the TNL class management system.
|
Data Fields |
| Position | startPos |
| Position | endPos |
| | All players move along a line from startPos to endPos.
|
| Position | renderPos |
| | Position at which to render the player - computed during update().
|
| TNL::F32 | t |
| | Parameter of how far the player is along the line from startPos to endPos.
|
| TNL::F32 | tDelta |
| | Change in t per second (ie, velocity).
|
| TestGame * | game |
| | The game object this player is associated with.
|
| PlayerType | myPlayerType |
| | What type of player is this?
|
Private Types |
| typedef TNL::NetObject | Parent |