当前位置: 首页>>代码示例>>C++>>正文


C++ IAIObject::GetVisionID方法代码示例

本文整理汇总了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;
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:13,代码来源:AIAwarenessToPlayerHelper.cpp

示例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;
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:53,代码来源:AIAwarenessToPlayerHelper.cpp


注:本文中的IAIObject::GetVisionID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。