Pyrogenesis  trunk
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
CUnit Class Reference

#include <Unit.h>

Collaboration diagram for CUnit:
Collaboration graph
[legend]

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
 
void SetID (entity_id_t id)
 
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 CUnitCreate (const CStrW &actorName, uint32_t seed, CObjectManager &objectManager)
 

Private Member Functions

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

Private Attributes

const CActorDefm_Actor
 
CObjectEntrym_Object = nullptr
 
CModelAbstractm_Model = nullptr
 
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,
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()

CUnit * CUnit::Create ( const CStrW &  actorName,
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)

◆ SetID()

void CUnit::SetID ( entity_id_t  id)

◆ 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

CModelAbstract* CUnit::m_Model = nullptr
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: