Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
MoveAction Class Reference

Action used for moving. More...

#include <MoveAction.hpp>

Inheritance diagram for MoveAction:
Inheritance graph
Collaboration diagram for MoveAction:
Collaboration graph

Public Member Functions

 MoveAction (std::chrono::system_clock::time_point startTime, Coordinates target, std::shared_ptr< Entity > pEntity)
 
 ~MoveAction ()=default
 
Coordinates getTarget ()
 Returns the target location of the action. More...
 
virtual void act ()
 Movement functionality, which finds the shortest path to target location and performs the movement there. Implementation of pure virtual method act() of the base class. More...
 
CurrentAction getActionInfo ()
 Returns information about the current action. More...
 
- Public Member Functions inherited from Action
 Action (std::chrono::system_clock::time_point startTime, std::shared_ptr< Entity > pEntity)
 
 ~Action ()=default
 
std::chrono::system_clock::time_point getStartTime ()
 Get the time when the action started. More...
 
std::chrono::milliseconds getActionTime ()
 Get the time how long a single iteration of the action takes. More...
 
ActionType getActionType ()
 Get the ActionType object. More...
 
bool isCompleted ()
 Returns true if the action is completed. More...
 

Static Public Member Functions

static const std::chrono::milliseconds getMoveTime ()
 Get the Move Time object. More...
 

Protected Attributes

Coordinates targetM
 
std::vector< std::pair< int, int > > pathM
 
std::optional< CoordinatesnextMoveM
 Next move to be taken. Stores the first element of pathM, after its deleted. Ww need this to be able to tell the client where we are moving next. More...
 
std::chrono::milliseconds actionTimeM
 
ActionType actionTypeM = ActionType::Move
 
- Protected Attributes inherited from Action
std::chrono::system_clock::time_point startTimeM
 
std::chrono::milliseconds actionTimeM = std::chrono::milliseconds(0)
 
ActionType actionTypeM = ActionType::None
 
std::shared_ptr< EntitypEntityM
 
bool completedM = false
 

Detailed Description

Action used for moving.

Constructor & Destructor Documentation

◆ MoveAction()

MoveAction::MoveAction ( std::chrono::system_clock::time_point  startTime,
Coordinates  target,
std::shared_ptr< Entity pEntity 
)

◆ ~MoveAction()

MoveAction::~MoveAction ( )
default

Member Function Documentation

◆ act()

void MoveAction::act ( )
virtual

Movement functionality, which finds the shortest path to target location and performs the movement there. Implementation of pure virtual method act() of the base class.

Implements Action.

Reimplemented in PickUpAction.

◆ getActionInfo()

CurrentAction MoveAction::getActionInfo ( )
virtual

Returns information about the current action.

Returns
CurrentAction

Reimplemented from Action.

◆ getMoveTime()

static const std::chrono::milliseconds MoveAction::getMoveTime ( )
static

Get the Move Time object.

Returns
const std::chrono::milliseconds

◆ getTarget()

Coordinates MoveAction::getTarget ( )

Returns the target location of the action.

Returns
Coordinates

Member Data Documentation

◆ actionTimeM

std::chrono::milliseconds MoveAction::actionTimeM
protected

◆ actionTypeM

ActionType MoveAction::actionTypeM = ActionType::Move
protected

◆ nextMoveM

std::optional<Coordinates> MoveAction::nextMoveM
protected

Next move to be taken. Stores the first element of pathM, after its deleted. Ww need this to be able to tell the client where we are moving next.

◆ pathM

std::vector<std::pair<int, int> > MoveAction::pathM
protected

◆ targetM

Coordinates MoveAction::targetM
protected

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