本文整理汇总了C++中CClientEntity::AttachTo方法的典型用法代码示例。如果您正苦于以下问题:C++ CClientEntity::AttachTo方法的具体用法?C++ CClientEntity::AttachTo怎么用?C++ CClientEntity::AttachTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClientEntity
的用法示例。
在下文中一共展示了CClientEntity::AttachTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AttachElements
void CElementRPCs::AttachElements ( NetBitStreamInterface& bitStream )
{
ElementID ID, usAttachedToID;
CVector vecPosition, vecRotation;
if ( bitStream.Read ( ID ) && bitStream.Read ( usAttachedToID ) &&
bitStream.Read ( vecPosition.fX ) &&
bitStream.Read ( vecPosition.fY ) &&
bitStream.Read ( vecPosition.fZ ) &&
bitStream.Read ( vecRotation.fX ) &&
bitStream.Read ( vecRotation.fY ) &&
bitStream.Read ( vecRotation.fZ ) )
{
CClientEntity* pEntity = CElementIDs::GetElement ( ID );
CClientEntity* pAttachedToEntity = CElementIDs::GetElement ( usAttachedToID );
if ( pEntity && pAttachedToEntity )
{
pEntity->SetAttachedOffsets ( vecPosition, vecRotation );
pEntity->AttachTo ( pAttachedToEntity );
}
}
}
示例2: DetachElements
void CElementRPCs::DetachElements ( NetBitStreamInterface& bitStream )
{
ElementID ID;
unsigned char ucTimeContext;
if ( bitStream.Read ( ID ) &&
bitStream.Read ( ucTimeContext ) )
{
CClientEntity* pEntity = CElementIDs::GetElement ( ID );
if ( pEntity )
{
pEntity->SetSyncTimeContext ( ucTimeContext );
pEntity->AttachTo ( NULL );
CVector vecPosition;
if ( bitStream.Read ( vecPosition.fX ) &&
bitStream.Read ( vecPosition.fY ) &&
bitStream.Read ( vecPosition.fZ ) )
{
pEntity->SetPosition ( vecPosition );
}
}
}
}
示例3: ClearChildren
CClientEntity::~CClientEntity ( void )
{
// Make sure we won't get deleted later by the element deleter if we've been requested so
if ( m_bBeingDeleted )
{
g_pClientGame->GetElementDeleter ()->Unreference ( this );
}
// Remove from parent
ClearChildren ();
SetParent ( NULL );
// Reset our index in the element array
if ( m_ID != INVALID_ELEMENT_ID )
{
CElementIDs::SetElement ( m_ID, NULL );
// Got a clientside ID? Push it back on our stack so we don't run out of client id's
if ( IsLocalEntity () )
{
CElementIDs::PushClientID ( m_ID );
}
}
// Remove our custom data
if ( m_pCustomData )
{
delete m_pCustomData;
}
// Detach from everything
AttachTo( NULL );
while( m_AttachedEntities.size() )
{
CClientEntity* pAttachedEntity = m_AttachedEntities.back();
pAttachedEntity->AttachTo( NULL );
}
m_bDisallowAttaching = true;
assert( !m_pAttachedToEntity && m_AttachedEntities.empty() );
RemoveAllCollisions ();
if ( m_pEventManager )
{
delete m_pEventManager;
m_pEventManager = NULL;
}
if ( m_pElementGroup )
{
m_pElementGroup->Remove ( this );
}
if ( m_OriginSourceUsers.size () > 0 )
{
list < CClientPed* > ::iterator iterUsers = m_OriginSourceUsers.begin ();
for ( ; iterUsers != m_OriginSourceUsers.end () ; iterUsers++ )
{
CClientPed* pModel = *iterUsers;
if ( pModel->m_interp.pTargetOriginSource == this )
{
pModel->m_interp.pTargetOriginSource = NULL;
pModel->m_interp.bHadOriginSource = true;
}
}
m_OriginSourceUsers.clear ();
}
// Unlink our contacts
list < CClientPed * > ::iterator iterContacts = m_Contacts.begin ();
for ( ; iterContacts != m_Contacts.end () ; iterContacts++ )
{
CClientPed * pModel = *iterContacts;
if ( pModel->GetCurrentContactEntity () == this )
{
pModel->SetCurrentContactEntity ( NULL );
}
}
m_Contacts.clear ();
// Unlink disabled-collisions
while ( !m_DisabledCollisions.empty () )
{
CClientEntity * pEntity = m_DisabledCollisions.begin ()->first;
SetCollidableWith ( pEntity, true );
}
// Remove from spatial database
if ( !g_pClientGame->IsBeingDeleted () )
GetClientSpatialDatabase ()->RemoveEntity ( this );
// Ensure not referenced in the disabled collisions list
assert ( !MapContains ( g_pClientGame->m_AllDisabledCollisions, this ) );
// Ensure nothing has inadvertently set a parent
assert ( m_pParent == NULL );
if ( !g_pClientGame->IsBeingDeleted () )
CClientEntityRefManager::OnEntityDelete ( this );
//.........这里部分代码省略.........