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

Actions used for interacting with objects. More...

#include <ObjectInteractAction.hpp>

Inheritance diagram for ObjectInteractAction:
Inheritance graph
Collaboration diagram for ObjectInteractAction:
Collaboration graph

Public Member Functions

 ObjectInteractAction (std::chrono::system_clock::time_point startTime, std::shared_ptr< Object > pTarget, std::shared_ptr< Entity > pEntity)
 
 ~ObjectInteractAction ()=default
 
void act ()
 Objecct interact functionality, which performs target object's interact functionality, and moves entity next to the object if not already. 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...
 

Private Attributes

std::shared_ptr< ObjectpTargetM
 
std::chrono::milliseconds actionTimeM = std::chrono::milliseconds(3000)
 
std::chrono::milliseconds moveTimeM
 
const ActionType actionTypeM = ActionType::ObjectInteract
 
std::vector< std::pair< int, int > > pathToTargetM
 Path to the target. More...
 
std::optional< CoordinatesnextMoveM
 Next move to be taken. More...
 
bool targetInRangeM = true
 True if the target is in range. More...
 

Additional Inherited Members

- 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

Actions used for interacting with objects.

Constructor & Destructor Documentation

◆ ObjectInteractAction()

ObjectInteractAction::ObjectInteractAction ( std::chrono::system_clock::time_point  startTime,
std::shared_ptr< Object pTarget,
std::shared_ptr< Entity pEntity 
)

◆ ~ObjectInteractAction()

ObjectInteractAction::~ObjectInteractAction ( )
default

Member Function Documentation

◆ act()

void ObjectInteractAction::act ( )
virtual

Objecct interact functionality, which performs target object's interact functionality, and moves entity next to the object if not already. Implementation of pure virtual method act() of the base class.

Implements Action.

◆ getActionInfo()

CurrentAction ObjectInteractAction::getActionInfo ( )
virtual

Returns information about the current action.

Returns
CurrentAction

Reimplemented from Action.

Member Data Documentation

◆ actionTimeM

std::chrono::milliseconds ObjectInteractAction::actionTimeM = std::chrono::milliseconds(3000)
private

◆ actionTypeM

const ActionType ObjectInteractAction::actionTypeM = ActionType::ObjectInteract
private

◆ moveTimeM

std::chrono::milliseconds ObjectInteractAction::moveTimeM
private

◆ nextMoveM

std::optional<Coordinates> ObjectInteractAction::nextMoveM
private

Next move to be taken.

◆ pathToTargetM

std::vector<std::pair<int, int> > ObjectInteractAction::pathToTargetM
private

Path to the target.

◆ pTargetM

std::shared_ptr<Object> ObjectInteractAction::pTargetM
private

◆ targetInRangeM

bool ObjectInteractAction::targetInRangeM = true
private

True if the target is in range.


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