本文整理汇总了C++中CElement::UpdatePerPlayerEntities方法的典型用法代码示例。如果您正苦于以下问题:C++ CElement::UpdatePerPlayerEntities方法的具体用法?C++ CElement::UpdatePerPlayerEntities怎么用?C++ CElement::UpdatePerPlayerEntities使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CElement
的用法示例。
在下文中一共展示了CElement::UpdatePerPlayerEntities方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetParentObject
CElement* CElement::SetParentObject ( CElement* pParent, bool bUpdatePerPlayerEntities )
{
// Different parent?
if ( pParent != m_pParent )
{
// Already got a parent?
if ( m_pParent )
{
// Call the on children remove on our current parent
m_pParent->OnSubtreeRemove ( this );
// Eventually unreference us from the previous parent entity
m_pParent->m_Children.remove ( this );
}
// Get into/out-of FromRoot info
bool bOldFromRoot = CElement::IsFromRoot ( m_pParent );
bool bNewFromRoot = CElement::IsFromRoot ( pParent );
// Moving out of FromRoot?
if ( bOldFromRoot && !bNewFromRoot )
CElement::RemoveEntityFromRoot ( m_uiTypeHash, this );
// Grab the root element now
CElement* pRoot;
if ( pParent )
{
pRoot = pParent->GetRootElement ();
}
else
{
assert ( m_pParent );
pRoot = m_pParent->GetRootElement ();
}
// Set the new parent
m_pParent = pParent;
// New parent?
if ( pParent )
{
// Add us to the new parent's child list
pParent->m_Children.push_back ( this );
// Moving into FromRoot?
if ( !bOldFromRoot && bNewFromRoot )
CElement::AddEntityFromRoot ( m_uiTypeHash, this );
// Call the on children add event on the new parent
pParent->OnSubtreeAdd ( this );
}
// Update all per-player references from the root and down
if ( bUpdatePerPlayerEntities )
pRoot->UpdatePerPlayerEntities ();
}
return pParent;
}