本文整理汇总了C++中Door::IsAITriggerable方法的典型用法代码示例。如果您正苦于以下问题:C++ Door::IsAITriggerable方法的具体用法?C++ Door::IsAITriggerable怎么用?C++ Door::IsAITriggerable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Door
的用法示例。
在下文中一共展示了Door::IsAITriggerable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void CAIVolume::Init(int32 iVolume, const AIVolume& vol)
{
char szName[128];
g_pLTServer->GetObjectName(vol.m_hObject, szName, 127);
m_hstrName = g_pLTServer->CreateString(szName);
m_iVolume = iVolume;
LTVector vVolumePos;
LTVector vVolumeDims;
g_pLTServer->GetObjectPos(vol.m_hObject, &vVolumePos);
g_pLTServer->GetObjectDims(vol.m_hObject, &vVolumeDims);
m_vFrontTopRight = vVolumePos + LTVector(vVolumeDims.x, vVolumeDims.y, vVolumeDims.z);
m_vFrontTopLeft = vVolumePos + LTVector(-vVolumeDims.x, vVolumeDims.y, vVolumeDims.z);
m_vBackTopRight = vVolumePos + LTVector(vVolumeDims.x, vVolumeDims.y, -vVolumeDims.z);
m_vBackTopLeft = vVolumePos + LTVector(-vVolumeDims.x, vVolumeDims.y, -vVolumeDims.z);
m_vFrontBottomRight = vVolumePos + LTVector(vVolumeDims.x, -vVolumeDims.y, vVolumeDims.z);
m_vFrontBottomLeft = vVolumePos + LTVector(-vVolumeDims.x, -vVolumeDims.y, vVolumeDims.z);
m_vBackBottomRight = vVolumePos + LTVector(vVolumeDims.x, -vVolumeDims.y, -vVolumeDims.z);
m_vBackBottomLeft = vVolumePos + LTVector(-vVolumeDims.x, -vVolumeDims.y, -vVolumeDims.z);
// Get the view volumes
for ( uint32 iViewNode = 0 ; iViewNode < kMaxViewNodes ; iViewNode++ )
{
if ( vol.GetViewNode(iViewNode) )
{
CAINode* pNode = g_pAINodeMgr->GetNode(vol.GetViewNode(iViewNode));
if ( pNode )
{
m_adwViewNodes[iViewNode] = pNode->GetID();
}
else
{
g_pLTServer->CPrint("********** Volume ''%s'' has a view node that does not exist!", GetName());
}
}
}
// Find any doors located in our volume
HCLASS hDoor = g_pLTServer->GetClass("Door");
HCLASS hSwitch = g_pLTServer->GetClass("Switch");
HOBJECT hCurObject = LTNULL;
while (hCurObject = g_pLTServer->GetNextObject(hCurObject))
{
if (g_pLTServer->IsKindOf(g_pLTServer->GetObjectClass(hCurObject), hDoor) && !g_pLTServer->IsKindOf(g_pLTServer->GetObjectClass(hCurObject), hSwitch))
{
Door* pDoor = (Door*)g_pLTServer->HandleToObject(hCurObject);
if ( !pDoor->IsAITriggerable() ) continue;
LTVector vPos;
LTVector vDims;
g_pLTServer->GetObjectPos(hCurObject, &vPos);
g_pLTServer->GetObjectDims(hCurObject, &vDims);
if ( Inside(vPos, vDims.y*2.0f) )
{
if ( m_cDoors == cm_nMaxDoors )
{
_ASSERT(!"Max number of doors in a volume exceeded!!!!");
g_pLTServer->CPrint("Max number of doors in a volume exceeded!!!!");
}
else
{
m_bHadDoors = LTTRUE;
g_pAIVolumeMgr->Link(hCurObject);
m_ahDoors[m_cDoors++] = hCurObject;
}
}
}
}
hCurObject = LTNULL;
while (hCurObject = g_pLTServer->GetNextInactiveObject(hCurObject))
{
if (g_pLTServer->IsKindOf(g_pLTServer->GetObjectClass(hCurObject), hDoor) && !g_pLTServer->IsKindOf(g_pLTServer->GetObjectClass(hCurObject), hSwitch))
{
Door* pDoor = (Door*)g_pLTServer->HandleToObject(hCurObject);
if ( !pDoor->IsAITriggerable() ) continue;
LTVector vPos;
LTVector vDims;
g_pLTServer->GetObjectPos(hCurObject, &vPos);
g_pLTServer->GetObjectDims(hCurObject, &vDims);
if ( Inside(vPos, vDims.y*2.0f) )
{
if ( m_cDoors == cm_nMaxDoors )
{
_ASSERT(!"Max number of doors in a volume exceeded!!!!");
g_pLTServer->CPrint("Max number of doors in a volume exceeded!!!!");
}
else
{
//.........这里部分代码省略.........