本文整理汇总了C++中IAIObject::GetVisionID方法的典型用法代码示例。如果您正苦于以下问题:C++ IAIObject::GetVisionID方法的具体用法?C++ IAIObject::GetVisionID怎么用?C++ IAIObject::GetVisionID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAIObject
的用法示例。
在下文中一共展示了IAIObject::GetVisionID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAlertnessAffectedByVisibility
int CAIAwarenessToPlayerHelper::GetAlertnessAffectedByVisibility(const IAIActor& aiActor, const IAIObject& playerAiObject, const bool playerIsCloaked) const
{
int alertness = aiActor.GetProxy()->GetAlertnessState();
// Clamp the alertness to orange (1) if the player is cloaked or
// if he's not currently seen by this ai actor.
if (playerIsCloaked || !aiActor.CanSee(playerAiObject.GetVisionID()))
{
alertness = std::min(alertness, 1);
}
return alertness;
}
示例2: GetMarkerColorForAgent
CAIAwarenessToPlayerHelper::VisorIconColor CAIAwarenessToPlayerHelper::GetMarkerColorForAgent(const EntityId entityId) const
{
CAIAwarenessToPlayerHelper::VisorIconColor defaultColor = Green;
IEntity* entity = gEnv->pEntitySystem->GetEntity(entityId);
const IAIObject* ai = entity ? entity->GetAI() : NULL;
const IAIActor* aiActor = ai ? ai->CastToIAIActor() : NULL;
IAIObject* playerAiObject = NULL;
CActor* playerActor = static_cast<CActor*>(gEnv->pGame->GetIGameFramework()->GetClientActor());
if (playerActor)
{
if (IEntity* playerEntity = playerActor->GetEntity())
{
playerAiObject = playerEntity->GetAI();
}
}
if (!playerActor || !playerAiObject)
return defaultColor;
const bool playerIsCloaked = playerActor->IsCloaked();
if (aiActor)
{
const int alertness = GetAlertnessAffectedByVisibility(*aiActor, *playerAiObject, playerIsCloaked);
if (alertness == 0)
return Green;
else if (alertness == 1)
return Orange;
else
return Red;
}
else
{
// Turrets are not AI actors so they are treated a bit differently
// TODO: extend this to generic IAwarenessEntity. for now in C3 is fine as we dont want Towers to be show here.
if (CTurret* turret = TurretHelpers::FindTurret(entityId))
{
if (IEntity* turretEntity = turret->GetEntity())
{
if (IAIObject* turretAI = turretEntity->GetAI())
{
const bool turretIsDeployed = (turret->GetStateId() == eTurretBehaviorState_Deployed);
if (!playerIsCloaked && turretIsDeployed && turretAI->IsHostile(playerAiObject) && turret->IsVisionIdInVisionRange(playerAiObject->GetVisionID()))
return Red;
else
return Green;
}
}
}
}
return defaultColor;
}