Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CUnit Class Reference

#include <Unit.h>

Collaboration diagram for CUnit:

Public Member Functions

 ~CUnit ()
 
const CObjectEntryGetObject () const
 
CModelAbstractGetModel () const
 
CUnitAnimationGetAnimation ()
 
void UpdateModel (float frameTime)
 Update the model's animation. More...
 
void SetEntitySelection (const CStr &key, const CStr &selection)
 
void SetEntitySelection (const std::map< CStr, CStr > &selections)
 
entity_id_t GetID () const
 
const std::set< CStr > & GetActorSelections () const
 
void SetActorSelections (const std::set< CStr > &selections)
 Overwrite the seed-selected actor selections. More...
 

Static Public Member Functions

static std::unique_ptr< CUnitCreate (const CStrW &actorName, const entity_id_t id, const uint32_t seed, CObjectManager &objectManager)
 

Private Member Functions

 NONCOPYABLE (CUnit)
 
 CUnit (CObjectManager &objectManager, const CActorDef &actor, const entity_id_t id, const uint32_t seed)
 
void ReloadObject ()
 

Private Attributes

const CActorDefm_Actor
 
CObjectEntrym_Object = nullptr
 
std::unique_ptr< CModelAbstractm_Model
 
CUnitAnimationm_Animation = nullptr
 
entity_id_t m_ID
 
uint32_t m_Seed
 
std::set< CStr > m_ActorSelections
 
std::map< CStr, CStr > m_EntitySelections
 
CObjectManagerm_ObjectManager
 

Friends

class CUnitAnimation
 

Constructor & Destructor Documentation

◆ CUnit()

CUnit::CUnit ( CObjectManager objectManager,
const CActorDef actor,
const entity_id_t  id,
const uint32_t  seed 
)
private

When entity selections change, we might end up with a different layout in terms of variants/groups, which means the random key calculation might end up with different results for the same seed. This is bad, as it means entities randomly change appearence when changing e.g. animation. To fix this, we'll initially pick a random and complete specification based on our seed, and then pass that as the lowest priority selections. Thus, if the actor files are properly specified, we can ensure that the entities will look the same no matter what happens.

◆ ~CUnit()

CUnit::~CUnit ( )

Member Function Documentation

◆ Create()

std::unique_ptr< CUnit > CUnit::Create ( const CStrW &  actorName,
const entity_id_t  id,
const uint32_t  seed,
CObjectManager objectManager 
)
static

◆ GetActorSelections()

const std::set< CStr > & CUnit::GetActorSelections ( ) const
inline

◆ GetAnimation()

CUnitAnimation * CUnit::GetAnimation ( )
inline

◆ GetID()

entity_id_t CUnit::GetID ( ) const
inline

◆ GetModel()

CModelAbstract & CUnit::GetModel ( ) const
inline

◆ GetObject()

const CObjectEntry & CUnit::GetObject ( ) const
inline

◆ NONCOPYABLE()

CUnit::NONCOPYABLE ( CUnit  )
private

◆ ReloadObject()

void CUnit::ReloadObject ( )
private

◆ SetActorSelections()

void CUnit::SetActorSelections ( const std::set< CStr > &  selections)

Overwrite the seed-selected actor selections.

Likely only useful for Atlas or debugging.

◆ SetEntitySelection() [1/2]

void CUnit::SetEntitySelection ( const CStr &  key,
const CStr &  selection 
)

◆ SetEntitySelection() [2/2]

void CUnit::SetEntitySelection ( const std::map< CStr, CStr > &  selections)

◆ UpdateModel()

void CUnit::UpdateModel ( float  frameTime)

Update the model's animation.

Parameters
frameTimetime in seconds

Friends And Related Function Documentation

◆ CUnitAnimation

friend class CUnitAnimation
friend

Member Data Documentation

◆ m_Actor

const CActorDef& CUnit::m_Actor
private

◆ m_ActorSelections

std::set<CStr> CUnit::m_ActorSelections
private

◆ m_Animation

CUnitAnimation* CUnit::m_Animation = nullptr
private

◆ m_EntitySelections

std::map<CStr, CStr> CUnit::m_EntitySelections
private

◆ m_ID

entity_id_t CUnit::m_ID
private

◆ m_Model

std::unique_ptr<CModelAbstract> CUnit::m_Model
private

◆ m_Object

CObjectEntry* CUnit::m_Object = nullptr
private

◆ m_ObjectManager

CObjectManager& CUnit::m_ObjectManager
private

◆ m_Seed

uint32_t CUnit::m_Seed
private

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