Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
MoveAction.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../world/Coordinates.hpp"
4 #include "Action.hpp"
5 
6 #include <vector>
7 
11 class MoveAction : public Action
12 {
13 public:
14  MoveAction(std::chrono::system_clock::time_point startTime, Coordinates target, std::shared_ptr<Entity> pEntity);
15 
16  ~MoveAction() = default;
17 
23 
28  virtual void act();
29 
35  static const std::chrono::milliseconds getMoveTime();
36 
42  CurrentAction getActionInfo();
43 
44 protected:
46 
47  std::vector<std::pair<int, int>> pathM;
48  std::optional<Coordinates> nextMoveM;
49 
50  std::chrono::milliseconds actionTimeM;
51 
52  ActionType actionTypeM = ActionType::Move;
53 };
Represents an action that an entity can perform.
Definition: Action.hpp:15
Action used for moving.
Definition: MoveAction.hpp:12
Coordinates getTarget()
Returns the target location of the action.
Definition: MoveAction.cpp:17
static const std::chrono::milliseconds getMoveTime()
Get the Move Time object.
MoveAction(std::chrono::system_clock::time_point startTime, Coordinates target, std::shared_ptr< Entity > pEntity)
Definition: MoveAction.cpp:7
Coordinates targetM
Definition: MoveAction.hpp:45
std::vector< std::pair< int, int > > pathM
Definition: MoveAction.hpp:47
std::chrono::milliseconds actionTimeM
Definition: MoveAction.hpp:50
ActionType actionTypeM
Definition: MoveAction.hpp:52
~MoveAction()=default
virtual void act()
Movement functionality, which finds the shortest path to target location and performs the movement th...
Definition: MoveAction.cpp:22
std::optional< Coordinates > nextMoveM
Next move to be taken. Stores the first element of pathM, after its deleted. Ww need this to be able ...
Definition: MoveAction.hpp:48
CurrentAction getActionInfo()
Returns information about the current action.
Definition: MoveAction.cpp:55
Struct for coordinates.
Definition: Coordinates.hpp:7