Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
Action Class Referenceabstract

Represents an action that an entity can perform. More...

#include <Action.hpp>

Inheritance diagram for Action:
Inheritance graph
Collaboration diagram for Action:
Collaboration graph

Public Member Functions

 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...
 
virtual CurrentAction getActionInfo ()
 Returns information about the current action. This is used to send information to the client. More...
 
bool isCompleted ()
 Returns true if the action is completed. More...
 
virtual void act ()=0
 Functionality for the action, pure virtual function that needs to be implemented by derived classes. Gets called on every server tick. More...
 

Protected Attributes

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

Represents an action that an entity can perform.

Constructor & Destructor Documentation

◆ Action()

Action::Action ( std::chrono::system_clock::time_point  startTime,
std::shared_ptr< Entity pEntity 
)

◆ ~Action()

Action::~Action ( )
default

Member Function Documentation

◆ act()

virtual void Action::act ( )
pure virtual

Functionality for the action, pure virtual function that needs to be implemented by derived classes. Gets called on every server tick.

Implemented in RespawnAction, PickUpAction, ObjectInteractAction, MoveAction, and AttackAction.

◆ getActionInfo()

CurrentAction Action::getActionInfo ( )
virtual

Returns information about the current action. This is used to send information to the client.

Returns
CurrentAction

Reimplemented in RespawnAction, ObjectInteractAction, MoveAction, and AttackAction.

◆ getActionTime()

std::chrono::milliseconds Action::getActionTime ( )

Get the time how long a single iteration of the action takes.

Returns
std::chrono::milliseconds

◆ getActionType()

ActionType Action::getActionType ( )

Get the ActionType object.

Returns
ActionType

◆ getStartTime()

std::chrono::system_clock::time_point Action::getStartTime ( )

Get the time when the action started.

Returns
std::chrono::system_clock::time_point

◆ isCompleted()

bool Action::isCompleted ( )

Returns true if the action is completed.

Returns
boolean

Member Data Documentation

◆ actionTimeM

std::chrono::milliseconds Action::actionTimeM = std::chrono::milliseconds(0)
protected

◆ actionTypeM

ActionType Action::actionTypeM = ActionType::None
protected

◆ completedM

bool Action::completedM = false
protected

◆ pEntityM

std::shared_ptr<Entity> Action::pEntityM
protected

◆ startTimeM

std::chrono::system_clock::time_point Action::startTimeM
protected

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