Terminus
Public Member Functions | Protected Attributes | List of all members
terminus::ProjectileHitCommand Class Reference

The ProjectileHitCommand indicates that a projectile hit a wagon. It contains the wagonIndex as well as the damage dealt. More...

#include <projectilehitcommand.h>

Inheritance diagram for terminus::ProjectileHitCommand:
terminus::AbstractCommand

Public Member Functions

 ProjectileHitCommand (Timer::TimerMSec timeStamp, bool rightTrain, int wagonIndex, float damage)
 
 ProjectileHitCommand (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...
 
bool rightTrain () const
 
int wagonIndex () const
 
float damage () 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

bool m_rightTrain
 
int m_wagonIndex
 
float m_damage
 
- Protected Attributes inherited from terminus::AbstractCommand
Gamem_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)
 

Detailed Description

The ProjectileHitCommand indicates that a projectile hit a wagon. It contains the wagonIndex as well as the damage dealt.

It will update the local wagon health value.

See also
Projectile, AbstractWagon

Constructor & Destructor Documentation

terminus::ProjectileHitCommand::ProjectileHitCommand ( Timer::TimerMSec  timeStamp,
bool  rightTrain,
int  wagonIndex,
float  damage 
)
terminus::ProjectileHitCommand::ProjectileHitCommand ( Timer::TimerMSec  timeStamp,
QJsonObject  jsonObject 
)

Member Function Documentation

virtual Commands terminus::ProjectileHitCommand::commandType ( ) const
inlineoverridevirtual

Every Command must specify its type.

Returns
enum constant from Commands
See also
Commands

Implements terminus::AbstractCommand.

float terminus::ProjectileHitCommand::damage ( ) const
inline
void terminus::ProjectileHitCommand::doWork ( )
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.

bool terminus::ProjectileHitCommand::rightTrain ( ) const
inline
QJsonObject terminus::ProjectileHitCommand::toJson ( ) const
overridevirtual

Every command must define how its members can be serialized.

Returns
A QJsonObject containing the parameters / members

Implements terminus::AbstractCommand.

int terminus::ProjectileHitCommand::wagonIndex ( ) const
inline

Member Data Documentation

float terminus::ProjectileHitCommand::m_damage
protected
bool terminus::ProjectileHitCommand::m_rightTrain
protected
int terminus::ProjectileHitCommand::m_wagonIndex
protected

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