本文整理汇总了C++中CAI_Node::SetHint方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_Node::SetHint方法的具体用法?C++ CAI_Node::SetHint怎么用?C++ CAI_Node::SetHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_Node
的用法示例。
在下文中一共展示了CAI_Node::SetHint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnRestore
void CAI_Hint::OnRestore()
{
BaseClass::OnRestore();
m_NodeData.nNodeID = g_pAINetworkManager->GetEditOps()->GetNodeIdFromWCId( m_NodeData.nWCNodeID );
FixupTargetNode();
CAI_Node *pNode = GetNode();
if ( !pNode )
{
if ( m_NodeData.nWCNodeID > 0 )
DevMsg("Warning: AI hint has incorrect or no AI node\n");
}
else
{
m_NodeData.vecPosition = pNode->GetOrigin();
Teleport( &m_NodeData.vecPosition, NULL, NULL );
pNode->SetHint( this );
}
}
示例2: Spawn
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pMapData -
//-----------------------------------------------------------------------------
int CNodeEnt::Spawn( const char *pMapData )
{
m_NodeData.strEntityName = GetEntityName();
m_NodeData.vecPosition = GetAbsOrigin();
m_NodeData.nNodeID = NO_NODE;
if ( m_NodeData.minState == NPC_STATE_NONE )
m_NodeData.minState = NPC_STATE_IDLE;
if ( m_NodeData.maxState == NPC_STATE_NONE )
m_NodeData.maxState = NPC_STATE_COMBAT;
// ---------------------------------------------------------------------------------
// If just a hint node (not used for navigation) just create a hint and bail
// ---------------------------------------------------------------------------------
if (FClassnameIs( this, "info_hint" ))
{
if (m_NodeData.nHintType)
{
CAI_HintManager::CreateHint( &m_NodeData, pMapData );
}
else
{
Warning("info_hint (HammerID: %d, position (%.2f, %.2f, %.2f)) with no hint type.\n", m_NodeData.nWCNodeID, m_NodeData.vecPosition.x, m_NodeData.vecPosition.y, m_NodeData.vecPosition.z );
}
UTIL_RemoveImmediate( this );
return -1;
}
// ---------------------------------------------------------------------------------
// First check if this node has a hint. If so create a hint entity
// ---------------------------------------------------------------------------------
CAI_Hint *pHint = NULL;
if ( ClassMatches( "info_node_hint" ) || ClassMatches( "info_node_air_hint" ) )
{
if ( m_NodeData.nHintType || m_NodeData.strGroup != NULL_STRING || m_NodeData.strEntityName != NULL_STRING )
{
m_NodeData.nNodeID = m_nNodeCount;
pHint = CAI_HintManager::CreateHint( &m_NodeData, pMapData );
pHint->AddSpawnFlags( GetSpawnFlags() );
}
}
// ---------------------------------------------------------------------------------
// If we loaded from disk, we can discard all these node ents as soon as they spawn
// unless we are in WC edited mode
// ---------------------------------------------------------------------------------
if ( g_pAINetworkManager->NetworksLoaded() && !engine->IsInEditMode())
{
// If hint exists for this node, set it
if (pHint)
{
CAI_Node *pNode = g_pBigAINet->GetNode(m_nNodeCount);
if (pNode)
pNode->SetHint( pHint );
else
{
DevMsg("AI node graph corrupt\n");
}
}
m_nNodeCount++;
UTIL_RemoveImmediate( this );
return -1;
}
else
{
m_nNodeCount++;
}
// ---------------------------------------------------------------------------------
// Add a new node to the network
// ---------------------------------------------------------------------------------
// For now just using one big AI network
CAI_Node *new_node = g_pBigAINet->AddNode( GetAbsOrigin(), GetAbsAngles().y );
new_node->SetHint( pHint );
// -------------------------------------------------------------------------
// Update table of how each WC id relates to each engine ID
// -------------------------------------------------------------------------
if (g_pAINetworkManager->GetEditOps()->m_pNodeIndexTable)
{
g_pAINetworkManager->GetEditOps()->m_pNodeIndexTable[new_node->GetId()] = m_NodeData.nWCNodeID;
}
// Keep track of largest index used by WC
if (g_pAINetworkManager->GetEditOps()->m_nNextWCIndex <= m_NodeData.nWCNodeID)
{
g_pAINetworkManager->GetEditOps()->m_nNextWCIndex = m_NodeData.nWCNodeID+1;
}
// -------------------------------------------------------------------------
// If in WC edit mode:
// Remember the original positions of the nodes before
// they drop so we can send the undropped positions to wc.
// -------------------------------------------------------------------------
if (engine->IsInEditMode())
{
if (g_pAINetworkManager->GetEditOps()->m_pWCPosition)
//.........这里部分代码省略.........
示例3: Spawn
//=========================================================
//=========================================================
void CNodeEnt::Spawn( void )
{
// ---------------------------------------------------------------------------------
// If just a hint node (not used for navigation) just create a hint and bail
// ---------------------------------------------------------------------------------
if (FClassnameIs( this, "info_hint" ))
{
if (m_eHintType)
{
CAI_Hint::CreateHint(GetEntityName(),GetAbsOrigin(),(Hint_e)m_eHintType,NO_NODE,m_strGroup);
}
else
{
Msg("WARNING: Hint node with no hint type!\n");
}
UTIL_RemoveImmediate( this );
return;
}
// ---------------------------------------------------------------------------------
// First check if this node has a hint. If so create a hint entity
// ---------------------------------------------------------------------------------
CAI_Hint *pHint = NULL;
if (m_eHintType || m_strGroup != NULL_STRING)
{
pHint = CAI_Hint::CreateHint(GetEntityName(),GetAbsOrigin(),(Hint_e)m_eHintType,m_nNodeCount,m_strGroup);
}
// ---------------------------------------------------------------------------------
// If we loaded from disk, we can discard all these node ents as soon as they spawn
// unless we are in WC edited mode
// ---------------------------------------------------------------------------------
if ( g_pAINetworkManager->NetworksLoaded() && !engine->IsInEditMode())
{
// If hint exists for this node, set it
if (pHint)
{
CAI_Node *pNode = g_pBigAINet->GetNode(m_nNodeCount);
if (pNode)
pNode->SetHint( pHint );
else
{
Msg("AI node graph corrupt\n");
}
}
m_nNodeCount++;
UTIL_RemoveImmediate( this );
return;
}
else
{
m_nNodeCount++;
}
// ---------------------------------------------------------------------------------
// Add a new node to the network
// ---------------------------------------------------------------------------------
// For now just using one big AI network
CAI_Node *new_node = g_pBigAINet->AddNode( GetAbsOrigin(), GetAbsAngles().y );
new_node->SetHint( pHint );
// -------------------------------------------------------------------------
// Update table of how each WC id relates to each engine ID
// -------------------------------------------------------------------------
if (g_pAINetworkManager->GetEditOps()->m_pNodeIndexTable)
{
g_pAINetworkManager->GetEditOps()->m_pNodeIndexTable[new_node->GetId()] = m_nWCNodeID;
}
// Keep track of largest index used by WC
if (g_pAINetworkManager->GetEditOps()->m_nNextWCIndex <= m_nWCNodeID)
{
g_pAINetworkManager->GetEditOps()->m_nNextWCIndex = m_nWCNodeID+1;
}
// -------------------------------------------------------------------------
// If in WC edit mode:
// Remember the original positions of the nodes before
// they drop so we can send the undropped positions to wc.
// -------------------------------------------------------------------------
if (engine->IsInEditMode())
{
if (g_pAINetworkManager->GetEditOps()->m_pWCPosition)
{
g_pAINetworkManager->GetEditOps()->m_pWCPosition[new_node->GetId()] = new_node->GetOrigin();
}
}
if (FClassnameIs( this, "info_node_air" ) || FClassnameIs( this, "info_node_air_hint" ))
{
new_node->SetType( NODE_AIR );
}
else if (FClassnameIs( this, "info_node_climb" ))
{
new_node->SetType( NODE_CLIMB );
}
else
{
//.........这里部分代码省略.........