本文整理汇总了C++中CGameObject::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameObject::GetType方法的具体用法?C++ CGameObject::GetType怎么用?C++ CGameObject::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameObject
的用法示例。
在下文中一共展示了CGameObject::GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TargetEnemy
void CEnemy::TargetEnemy()
{
CGameObject* pCurrentObj = GetWhoIsAroundMe2(400.0f);
CGameObject* pFirstGuy = pCurrentObj;
m_CurrentTarget = &g_Player;
float Dist = DistanceSquare(&(GetSphere()->Center), &(g_Player.GetSphere()->Center));
float TempDist;
if (pCurrentObj != NULL)
{
do
{
switch(pCurrentObj->GetType())
{
case OBJ_BUILDING:
case OBJ_BUILDING2:
case OBJ_BUILDING3:
{
TempDist = DistanceSquare(&(GetSphere()->Center), &(pCurrentObj->GetSphere()->Center));
if (TempDist < Dist)
{
m_CurrentTarget = pCurrentObj;
Dist = TempDist;
}
break;
};
case OBJ_FTURRET:
{
TempDist = DistanceSquare(&(GetSphere()->Center), &(pCurrentObj->GetSphere()->Center));
if (TempDist < Dist)
{
m_CurrentTarget = pCurrentObj;
Dist = TempDist;
}
break;
};
case OBJ_CONVOY:
{
TempDist = DistanceSquare(&(GetSphere()->Center), &(pCurrentObj->GetSphere()->Center));
if (TempDist < Dist)
{
m_CurrentTarget = pCurrentObj;
Dist = TempDist;
}
break;
};
default:
break;
};
pCurrentObj = pCurrentObj->m_GuyNextToMe;
} while (pCurrentObj != NULL);
}
ClearWhoIsAroundMe(pFirstGuy);
}
示例2: CArea_RemoveAreaAirEffectSpecific
void CArea_RemoveAreaAirEffectSpecific(CArea& area, ResRef& rResource) {
if (0) IECString("CArea_RemoveAreaAirEffectSpecific");
bool bUseResource = true;
CRuleTable crtResource;
crtResource.LoadTable(rResource);
if (crtResource.m_2da.bLoaded == FALSE) {
LPCTSTR lpsz = "CArea_RemoveAreaAirEffectSpecific(): %s.2da not found, using ClearAir.2da...\r\n";
L.timestamp();
L.appendf(lpsz, rResource.GetBuffer());
console.writef(lpsz, rResource.GetBuffer());
bUseResource = false;
}
POSITION pos = area.m_lVertSortFront.GetHeadPosition();
while (pos != NULL) {
ENUM e = (ENUM)area.m_lVertSortFront.GetNext(pos);
CGameObject* pObj;
if (g_pChitin->pGame->m_GameObjectArray.GetShare(e, THREAD_ASYNCH, &pObj, -1) == OBJECT_SUCCESS) {
if (pObj->GetType() == CGAMEOBJECT_TYPE_PROJECTILE) {
IECString sMissileId;
sMissileId.Format("%d", ((CProjectile*)pObj)->nMissileId);
POSITION posString;
bool bFound = bUseResource
? crtResource.FindString(sMissileId, &posString, FALSE)
: g_pChitin->pGame->CLEARAIR.FindString(sMissileId, &posString, FALSE);
if (bFound) {
char nResult;
do {
nResult = g_pChitin->pGame->m_GameObjectArray.GetDeny(e, THREAD_ASYNCH, &pObj, INFINITE);
} while (nResult == OBJECT_SHARING);
if (nResult == OBJECT_SUCCESS) {
pObj->RemoveFromArea();
g_pChitin->pGame->m_GameObjectArray.FreeDeny(e, THREAD_ASYNCH, INFINITE);
}
}
}
else if (pObj->GetType() == CGAMEOBJECT_TYPE_SMOKE) {
bool bRemoveSmoke = false;
AnimData& animData = ((CSmokeObject*)pObj)->m_animation;
assert(animData.pAnimation != NULL);
short wAnimId = animData.pAnimation->wAnimId;
if (bUseResource) {
char szSmokeId[7] = {0};
sprintf_s(szSmokeId, "0x%.4X", wAnimId & 0xFF0F);
IECString sSmokeId(szSmokeId);
POSITION posString;
bRemoveSmoke = crtResource.FindString(sSmokeId, &posString, FALSE);
}
else if ((wAnimId & 0xFF0F) == 0x500) { //STINKCLOUD_*
bRemoveSmoke = true;
}
if (bRemoveSmoke) {
char nResult;
do {
nResult = g_pChitin->pGame->m_GameObjectArray.GetDeny(e, THREAD_ASYNCH, &pObj, INFINITE);
} while (nResult == OBJECT_SHARING);
if (nResult == OBJECT_SUCCESS) {
pObj->RemoveFromArea();
g_pChitin->pGame->m_GameObjectArray.FreeDeny(e, THREAD_ASYNCH, INFINITE);
}
}
}
g_pChitin->pGame->m_GameObjectArray.FreeShare(e, THREAD_ASYNCH, INFINITE);
}
}
return;
}