本文整理汇总了C++中PetManager::GetInitData方法的典型用法代码示例。如果您正苦于以下问题:C++ PetManager::GetInitData方法的具体用法?C++ PetManager::GetInitData怎么用?C++ PetManager::GetInitData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PetManager
的用法示例。
在下文中一共展示了PetManager::GetInitData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
BOOL Obj_Pet::Init( const _OBJ_INIT *pInit )
{
__ENTER_FUNCTION
BOOL bResult = Obj_Character::Init( pInit );
if ( !bResult )
return FALSE;
const _OBJ_PET_INIT *pPetInit = NULL;
pPetInit = (const _OBJ_PET_INIT*)pInit;
if ( pPetInit == NULL )
{
Assert( FALSE && "Error Obj_Pet::Init, pPetInit = NULL" );
return FALSE;
}
m_GUID = pPetInit->m_GUID;
m_CreatorID = pPetInit->m_CreatorID;
m_pCreator = NULL;
m_nIndex = pPetInit->m_nIndex;
m_iLevel = pPetInit->m_PetDB.m_nLevel;
if ( m_CreatorID != INVALID_ID )
{
Obj_Character *pCreator = (Obj_Character*)(getScene()->GetObjManager()->GetObj(m_CreatorID) );
if (pCreator != NULL && pCreator->GetObjType() == OBJ_TYPE_HUMAN)
m_pCreator = (Obj_Human*)pCreator;
}
if ( m_pCreator == NULL )
{
m_PetDB = pPetInit->m_PetDB;
return FALSE;
}
m_PetDB.m_nDataID = pPetInit->m_PetDB.m_nDataID;
m_RespawnTime = pPetInit->m_RespawnTime;
m_RespawnPos = pPetInit->m_Pos;
m_OwnerID = pPetInit->m_CreatorID;
m_HappinessTimer.BeginTimer( g_Config.m_ConfigInfo.m_PetHappinessInterval, g_pTimeManager->CurrentTime() );
SetDataID( m_pCreator->GetMonsterPetDataID() );
MONSTER_EXT_ATTR *pPetAttr = g_MonsterAttrExTbl.GetExtAttr( GetDataID() );
if(pPetAttr)
{
m_iLevel = pPetAttr->m_Level;
}
else
{
m_iLevel = 0;
}
PetManager* pPetManager = getScene()->GetPetManager();
if(pPetManager)
{
m_oInit = pPetManager->GetInitData();
}
//初始化技能相关内容
InitLife();
SetHP( GetMaxHP() );
// 使AI进入IDLE状态
GetAIObj()->ChangeState(ESTATE_IDLE);
InitBackupAttr();
//附加效果数据
Impact_InitList();
return TRUE;
__LEAVE_FUNCTION
return FALSE;
}