Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::Player Class Referencefinal

User controlled Unit. More...

#include <Player.h>

+ Inheritance diagram for Divide::Player:

Public Member Functions

 Player (U8 index)
 
 ~Player () override
 
 PROPERTY_R (bool, lockedControls, false)
 Do not allow or allow the user again to control this player.
 
 PROPERTY_R (U8, index, 0u)
 
 PROPERTY_R (vec3< F32 >, extents, VECTOR3_UNIT)
 
 POINTER_R (Camera, camera, nullptr)
 
- Public Member Functions inherited from Divide::Character
 Character (CharacterType type)
 
virtual void update (U64 deltaTimeUS)
 
virtual void setPosition (const vec3< F32 > &newPosition)
 Set the current position of this charater.
 
virtual void setVelocity (const vec3< F32 > &newVelocity)
 Update character velocity.
 
virtual vec3< F32getPosition () const
 The current position of this character.
 
virtual vec3< F32getLookingDirection ()
 The direction in which the character is currently looking.
 
virtual void lookAt (const vec3< F32 > &targetPos)
 Rotate the character to look at another character.
 
const vec3< F32 > & getRelativeLookingDirection () const noexcept
 
void setRelativeLookingDirection (const vec3< F32 > &direction) noexcept
 
void playAnimation (U32 index) const
 
void playNextAnimation () const
 
void playPreviousAnimation () const
 
void pauseAnimation (bool state) const
 
 PROPERTY_RW (CharacterType, characterType, CharacterType::COUNT)
 
- Public Member Functions inherited from Divide::Unit
 Unit (UnitType type)
 
virtual bool moveTo (const vec3< F32 > &targetPosition, const U64 deltaTimeUS)
 
virtual bool moveToX (F32 targetPosition, const U64 deltaTimeUS)
 Move along the X axis.
 
virtual bool moveToY (F32 targetPosition, const U64 deltaTimeUS)
 Move along the Y axis.
 
virtual bool moveToZ (F32 targetPosition, const U64 deltaTimeUS)
 Move along the Z axis.
 
virtual bool teleportTo (const vec3< F32 > &targetPosition)
 teleportTo instantly places the unit at the desired position
 
const vec3< F32 > & getCurrentPosition () const
 
const vec3< F32 > & getTargetPosition () const
 Get the unit's target coordinates in the world.
 
virtual void setMovementSpeed (const F32 movementSpeed)
 
virtual void setAcceleration (const F32 acceleration)
 Set the unit's acceleration in metres per second squared.
 
virtual F32 getMovementSpeed () const
 Get the unit's current movement speed.
 
virtual F32 getAcceleration () const
 Get the unit's acceleration rate.
 
void setMovementTolerance (const F32 movementTolerance)
 Set destination tolerance.
 
F32 getMovementTolerance () const
 Get the units current movement tolerance.
 
SceneGraphNodegetBoundNode () const
 Get bound node.
 
virtual void setAttribute (U32 attributeID, I32 initialValue)
 
virtual I32 getAttribute (U32 attributeID) const
 
 PROPERTY_RW (UnitType, type, UnitType::COUNT)
 
- Public Member Functions inherited from Divide::GUIDWrapper
 GUIDWrapper () noexcept
 
 GUIDWrapper (const GUIDWrapper &old) noexcept
 
 GUIDWrapper (GUIDWrapper &&old) noexcept
 
virtual ~GUIDWrapper ()=default
 
FORCE_INLINE I64 getGUID () const noexcept
 
GUIDWrapperoperator= (const GUIDWrapper &old)=delete
 
GUIDWrapperoperator= (GUIDWrapper &&other)=delete
 

Protected Member Functions

void setParentNode (SceneGraphNode *node) override
 
void setParentNode (SceneGraphNode *node) override
 
virtual void setParentNode (SceneGraphNode *node)
 

Additional Inherited Members

- Public Types inherited from Divide::Character
enum class  CharacterType : U8 { CHARACTER_TYPE_PLAYER = 0 , CHARACTER_TYPE_NPC , COUNT }
 Currently supported character types. More...
 
- Public Types inherited from Divide::Unit
using AttributeMap = hashMap< U32, I32 >
 
- Static Public Member Functions inherited from Divide::GUIDWrapper
static I64 generateGUID () noexcept
 
- Protected Attributes inherited from Divide::Unit
F32 _moveSpeed
 Movement speed (meters per second)
 
F32 _acceleration
 Acceleration (meters per second squared.
 
F32 _moveTolerance
 acceptable distance from target
 
vec3< F32_currentPosition
 Unit position in world.
 
vec3< F32_currentTargetPosition
 Current destination point cached.
 
SceneGraphNode_node
 
AttributeMap _attributes
 
SharedMutex _unitUpdateMutex
 
- Protected Attributes inherited from Divide::GUIDWrapper
const I64 _guid
 

Detailed Description

User controlled Unit.

Definition at line 44 of file Player.h.

Constructor & Destructor Documentation

◆ Player()

Divide::Player::Player ( U8  index)
explicit

Definition at line 14 of file Player.cpp.

◆ ~Player()

Divide::Player::~Player ( )
override

Definition at line 21 of file Player.cpp.

Member Function Documentation

◆ POINTER_R()

Divide::Player::POINTER_R ( Camera  ,
camera  ,
nullptr   
)

◆ PROPERTY_R() [1/3]

Divide::Player::PROPERTY_R ( bool  ,
lockedControls  ,
false   
)

Do not allow or allow the user again to control this player.

◆ PROPERTY_R() [2/3]

Divide::Player::PROPERTY_R ( U8  ,
index  ,
0u   
)

◆ PROPERTY_R() [3/3]

Divide::Player::PROPERTY_R ( vec3< F32 ,
extents  ,
VECTOR3_UNIT   
)

◆ setParentNode()

void Divide::Player::setParentNode ( SceneGraphNode node)
overrideprotectedvirtual

Reimplemented from Divide::Character.

Definition at line 26 of file Player.cpp.


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