Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | List of all members
core::component::Controllable Class Reference

Adding this component to an entity allows it to be controlled. More...

#include <Controllable.hpp>

Public Member Functions

 Controllable (system::Systems &systems, bl::ecs::Entity owner)
 Construct a new Controllable component. More...
 
bool processControl (input::EntityControl command, bool sprint=false, bool overrideLock=false)
 Processes the given command and manipulates the entity accordingly. More...
 
void setLocked (bool lock, bool preserve=true)
 Locks the controllable and prevents any commands from being processed. Optionally remembers the previous lock state to reset back to. More...
 
void resetLock ()
 Resets the lock state back to the last preserved state. More...
 
bool isLocked () const
 Returns whether or not this component is locked. More...
 

Detailed Description

Adding this component to an entity allows it to be controlled.

Definition at line 22 of file Controllable.hpp.

Constructor & Destructor Documentation

◆ Controllable()

core::component::Controllable::Controllable ( system::Systems systems,
bl::ecs::Entity  owner 
)

Construct a new Controllable component.

Parameters
systemsThe primary systems object
ownerThe entity that owns this component

Definition at line 10 of file Controllable.cpp.

Member Function Documentation

◆ isLocked()

bool core::component::Controllable::isLocked ( ) const

Returns whether or not this component is locked.

Definition at line 52 of file Controllable.cpp.

◆ processControl()

bool core::component::Controllable::processControl ( input::EntityControl  command,
bool  sprint = false,
bool  overrideLock = false 
)

Processes the given command and manipulates the entity accordingly.

Parameters
commandThe command to apply
sprintTrue to sprint, false to walk. Only has effect if processing a move control
overrideLockTrue to process the control even if locked
Returns
True if the control had effect, false if no effect

Definition at line 16 of file Controllable.cpp.

◆ resetLock()

void core::component::Controllable::resetLock ( )

Resets the lock state back to the last preserved state.

Definition at line 50 of file Controllable.cpp.

◆ setLocked()

void core::component::Controllable::setLocked ( bool  lock,
bool  preserve = true 
)

Locks the controllable and prevents any commands from being processed. Optionally remembers the previous lock state to reset back to.

Parameters
lockTrue to lock, false to unlock
preserveTrue to remember previous lock state, false to discard

Definition at line 45 of file Controllable.cpp.


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