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


C++ Agent::GetPos方法代码示例

本文整理汇总了C++中Agent::GetPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Agent::GetPos方法的具体用法?C++ Agent::GetPos怎么用?C++ Agent::GetPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Agent的用法示例。


在下文中一共展示了Agent::GetPos方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Execute

	virtual bool Execute(Agent *_Agent)
	{
		float dist2 = 0;
		if(_Agent->Attack)
		{
			Agent *TargetEnemy = nullptr;
			for ( auto EnemyCurrent : _Agent->Enemies)
			{
				TargetEnemy = EnemyCurrent;
				float Len = 0, tLen;

				tLen = glm::length(_Agent->GetPos()) - glm::length(EnemyCurrent->GetPos());
				if(tLen < 0){tLen *= -1;}
				if(tLen > Len){Len = tLen;TargetEnemy = EnemyCurrent;}
			}
			if(TargetEnemy != nullptr)
				dist2 = glm::distance2(_Agent->GetPos(), TargetEnemy->GetPos());
		}
		else
		{
			dist2 = glm::distance2(_Agent->GetPos(), _Agent->GetTarget());
		}

		if (dist2 < Range2)
			return true;
		return false;
	}
开发者ID:akurt5,项目名称:ComplexGameSystems,代码行数:27,代码来源:NavMesh.cpp

示例2: QueueLineOfSightRay

void StalkerModule::QueueLineOfSightRay(Agent& stalker, IAIObject* target, StalkerInstance& instance)
{
	PhysSkipList skipList;
	stalker.GetPhysicalSkipEntities(skipList);
	if (IAIActor* aiActor = target->CastToIAIActor())
		aiActor->GetPhysicalSkipEntities(skipList);

	instance.rayID = g_pGame->GetRayCaster().Queue(
		RayCastRequest::HighPriority,
		RayCastRequest(target->GetPos(), stalker.GetPos() - target->GetPos(),
		ent_terrain|ent_static|ent_rigid|ent_sleeping_rigid,
		((geom_colltype_ray << rwi_colltype_bit) | rwi_colltype_any | (10 & rwi_pierceability_mask)),
		&skipList[0], skipList.size()),
		functor(*this, &StalkerModule::LineOfSightRayComplete));
}
开发者ID:danielasun,项目名称:dbho-GameSDK,代码行数:15,代码来源:StalkerModule.cpp

示例3: CheckCollision

// ===========================================================================
// Process possible collision between an agent and the hazard.
//
//	In:		The agent.
//	Out:	The collision result (NULL is invalid!)
//
void HazardDataSphere::CheckCollision(Agent& agent, HazardCollisionResult* result) const
{
	assert(result != NULL);
	result->Reset();

	if (Distance::Point_PointSq(agent.GetPos(), m_Context.m_CenterPos) > 
		m_RadiusSq)
	{
		return;
	}		

	result->m_CollisionFlag = true;
	result->m_HazardOriginPos = m_Context.m_CenterPos;
	return;
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:21,代码来源:HazardSphere.cpp


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