本文整理汇总了C++中CObj::SetPos方法的典型用法代码示例。如果您正苦于以下问题:C++ CObj::SetPos方法的具体用法?C++ CObj::SetPos怎么用?C++ CObj::SetPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CObj
的用法示例。
在下文中一共展示了CObj::SetPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateMonster
void CCreateMonster::CreateMonster( CUser* pUser, DWORD dwObjId, D3DXVECTOR3 vPos )
{
if( (int)( m_mapCreateMonsterInfo.size() ) >= m_nMaxCreateNum )
{
pUser->AddDefinedText( TID_GAME_CREATEMON_LIMIT );
return;
}
CItemElem* pItemElem = pUser->m_Inventory.GetAtId( dwObjId );
if( !IsUsableItem( pItemElem ) )
return;
CREATE_MONSTER_PROP* pCreateMonsterProp = GetCreateMonsterProp( pItemElem );
if( !pCreateMonsterProp )
return;
DWORD dwMonsterId = pCreateMonsterProp->GetRandomMonsterId();
if( dwMonsterId == NULL_ID )
return;
CWorld* pWorld = pUser->GetWorld();
MoverProp* pMoverProp = prj.GetMoverProp( dwMonsterId );
if( pWorld && pMoverProp && pMoverProp->dwID != 0 )
{
D3DXVECTOR3 vDist2 = pUser->GetPos() - vPos;
float fDist = D3DXVec3Length( &vDist2 ); // 두좌표간의 거리
if( 15.f < fDist )
{
pUser->AddDefinedText( TID_GAME_CREATEMON_F_15 );
return;
}
int nAttr = pWorld->GetHeightAttribute( vPos.x, vPos.z ); // 이동할 위치의 속성 읽음.
if( nAttr == HATTR_NOWALK || nAttr == HATTR_NOMOVE ) // 못 움직이는 곳이면 Pass
{
pUser->AddDefinedText( TID_GAME_CREATEMON_F_AREA );
return;
}
if( pUser->IsRegionAttr( RA_SAFETY )) // 안전지역이면 Pass
{
pUser->AddDefinedText( TID_GAME_CREATEMON_F_AREA );
return;
}
if( pWorld->GetID() != WI_WORLD_MADRIGAL )
{
pUser->AddDefinedText( TID_GAME_CREATEMON_F_AREA );
return;
}
CObj* pObj = CreateObj( D3DDEVICE, OT_MOVER, pMoverProp->dwID );
if( NULL == pObj ) return; // ASSERT( pObj );
pObj->SetPos( vPos );
pObj->InitMotion( MTI_STAND );
pObj->UpdateLocalMatrix();
((CMover*)pObj)->m_bActiveAttack = FALSE;
((CMover*)pObj)->AddItToGlobalId();
pWorld->ADDOBJ( pObj, FALSE, pUser->GetLayer() );
LogItemInfo aLogItem;
aLogItem.Action = "i";
aLogItem.SendName = pUser->GetName();
char szTemp[128] = {0,};
sprintf( szTemp, "M_C_%s", pMoverProp->szName );
memset( szTemp+31, 0, sizeof(szTemp)-31 );
aLogItem.RecvName = szTemp;
aLogItem.Gold = aLogItem.Gold2 = pUser->GetGold();
aLogItem.Gold_1 = ((CMover*)pObj)->GetId();
aLogItem.WorldId = pUser->GetWorld()->GetID();
g_DPSrvr.OnLogItem( aLogItem, pItemElem, 1 );
pUser->AddDefinedText( TID_GAME_CREATEMON_S, "\"%s\"", pMoverProp->szName );
pUser->RemoveItem( (BYTE)( dwObjId ), (short)( 1 ) );
CREATE_MONSTER_INFO createMonsterInfo;
createMonsterInfo.chState = 'N';
createMonsterInfo.dwOwnerId = pUser->m_idPlayer;
createMonsterInfo.dwEndTick = pCreateMonsterProp->dwKeepTime + GetTickCount();
m_mapCreateMonsterInfo.insert( make_pair( ((CMover*)pObj)->GetId(), createMonsterInfo ) );
}
}