Terminus
|
The SyncCommand is used to keep shared game state synchronized. More...
#include <synccommand.h>
Public Member Functions | |
SyncCommand (Timer::TimerMSec timeStamp, const Train &playerTrain) | |
SyncCommand (Timer::TimerMSec timeStamp, QJsonObject jsonObject) | |
virtual QJsonObject | toJson () const override |
Every command must define how its members can be serialized. More... | |
virtual void | doWork () override |
Every Commands must define its effects on the receiving game. More... | |
virtual Commands | commandType () const override |
Every Command must specify its type. More... | |
const std::vector< float > & | wagonHealthVector () const |
Public Member Functions inherited from terminus::AbstractCommand | |
AbstractCommand (Timer::TimerMSec timeStamp) | |
virtual | ~AbstractCommand () |
void | setGame (Game *game) |
set the game instance this command should operate on More... | |
Timer::TimerMSec | timeStamp () const |
get the time as counted by the sending game that this command was created and sent More... | |
Protected Attributes | |
std::vector< float > | m_wagonHealthVector |
float | m_velocity |
float | m_travelledDistance |
Protected Attributes inherited from terminus::AbstractCommand | |
Game * | m_game |
Timer::TimerMSec | m_timeStamp |
Additional Inherited Members | |
Static Protected Member Functions inherited from terminus::AbstractCommand | |
static QJsonObject | VectorToJsonObject (QVector3D vector) |
static QVector3D | VectorFromJsonObject (QJsonObject jsonObject) |
The SyncCommand is used to keep shared game state synchronized.
It contains the local player train's travelled distance, velocity and health information of the wagons. It also synchronizes the game timers.
terminus::SyncCommand::SyncCommand | ( | Timer::TimerMSec | timeStamp, |
const Train & | playerTrain | ||
) |
terminus::SyncCommand::SyncCommand | ( | Timer::TimerMSec | timeStamp, |
QJsonObject | jsonObject | ||
) |
|
inlineoverridevirtual |
Every Command must specify its type.
Implements terminus::AbstractCommand.
|
overridevirtual |
Every Commands must define its effects on the receiving game.
This Method is guaranteed to be executed in the receiving game's frame update context with a valid Game instance in m_game
Implements terminus::AbstractCommand.
|
overridevirtual |
Every command must define how its members can be serialized.
Implements terminus::AbstractCommand.
|
inline |
|
protected |
|
protected |
|
protected |