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


C++ CFindPathTask::setNoInterruptions方法代码示例

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


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

示例1: if

CBotFollowLastEnemy ::	CBotFollowLastEnemy ( CBot *pBot, edict_t *pEnemy, Vector vLastSee )
{
	Vector vVelocity = Vector(0,0,0);
	CClient *pClient = CClients::get(pEnemy);

	CFindPathTask *pFindPath = new CFindPathTask(vLastSee,LOOK_LAST_ENEMY);	

	if ( CClassInterface :: getVelocity(pEnemy,&vVelocity) )
	{
		if ( pClient && (vVelocity == Vector(0,0,0)) )
			vVelocity = pClient->getVelocity();
	}
	else if ( pClient )
		vVelocity = pClient->getVelocity();

	pFindPath->setCompleteInterrupt(CONDITION_SEE_CUR_ENEMY);

	addTask(pFindPath);

	/*if ( pBot->isTF2() )
	{
		int playerclass = ((CBotTF2*)pBot)->getClass();
		
		if ( ( playerclass == TF_CLASS_SOLDIER ) || (playerclass == TF_CLASS_DEMOMAN) )
			addTask(new CBotTF2ShootLastEnemyPosition(vLastSee,pEnemy,vVelocity));
	}*/

	addTask(new CFindLastEnemy(vLastSee,vVelocity));

	//////////////
	pFindPath->setNoInterruptions();
}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:32,代码来源:bot_schedule.cpp

示例2: CGotoHideSpotSched

CGotoHideSpotSched :: CGotoHideSpotSched ( CBot *pBot, edict_t *pEdict, bool bIsGrenade )
{
	// run at flank while shooting	
	CFindPathTask *pHideGoalPoint = new CFindPathTask(pEdict);

	pBot->setCoverFrom(pEdict);
	addTask(new CFindGoodHideSpot(pEdict));
	addTask(pHideGoalPoint);
	if ( bIsGrenade )
		addTask(new CDODWaitForGrenadeTask(pEdict));

	// don't need to hide if the player we're hiding from died while we're running away
	pHideGoalPoint->failIfTaskEdictDead();
	pHideGoalPoint->setLookTask(LOOK_WAYPOINT);
	// no interrupts, should be a quick waypoint path anyway
	pHideGoalPoint->setNoInterruptions();
	// get vector from good hide spot task
	pHideGoalPoint->getPassedVector();
	pHideGoalPoint->dontGoToEdict();
	if ( bIsGrenade )
	{
		pHideGoalPoint->setRange(BLAST_RADIUS+100.0f);
		pHideGoalPoint->completeOutOfRangeFromEdict();
	}
}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:25,代码来源:bot_schedule.cpp

示例3: if


//.........这里部分代码省略.........
			pSched->addTask(new CBotHL2DMUseCharger(m_pCharger,CHARGER_ARMOR));

			m_pSchedules->add(pSched);

			m_fUtilTimes[BOT_UTIL_HL2DM_USE_CHARGER] = engine->Time() + randomFloat(5.0f,10.0f);
			return true;
		}
	case BOT_UTIL_HL2DM_GRAVIGUN_PICKUP:
		{
			CBotSchedule *pSched = new CBotSchedule(new CBotGravGunPickup(m_pCurrentWeapon,m_NearestPhysObj));
			pSched->setID(SCHED_GRAVGUN_PICKUP);
			m_pSchedules->add(pSched);
			return true;
		}
	case BOT_UTIL_FIND_LAST_ENEMY:
		{
			Vector vVelocity = Vector(0,0,0);
			CClient *pClient = CClients::get(m_pLastEnemy);
			CBotSchedule *pSchedule = new CBotSchedule();
			
			CFindPathTask *pFindPath = new CFindPathTask(m_vLastSeeEnemy);	

			pFindPath->setCompleteInterrupt(CONDITION_SEE_CUR_ENEMY);
			
			if ( !CClassInterface::getVelocity(m_pLastEnemy,&vVelocity) )
			{
				if ( pClient )
					vVelocity = pClient->getVelocity();
			}

			pSchedule->addTask(pFindPath);
			pSchedule->addTask(new CFindLastEnemy(m_vLastSeeEnemy,vVelocity));

			//////////////
			pFindPath->setNoInterruptions();

			m_pSchedules->add(pSchedule);

			m_bLookedForEnemyLast = true;

			return true;
		}
	case BOT_UTIL_THROW_GRENADE:
		{
		// find hide waypoint
			CWaypoint *pWaypoint = CWaypoints::getWaypoint(CWaypointLocations::GetCoverWaypoint(getOrigin(),m_vLastSeeEnemy,NULL));

			if ( pWaypoint )
			{
				CBotSchedule *pSched = new CBotSchedule();
				pSched->addTask(new CThrowGrenadeTask(m_pWeapons->getWeapon(CWeapons::getWeapon(HL2DM_WEAPON_FRAG)),getAmmo(CWeapons::getWeapon(HL2DM_WEAPON_FRAG)->getAmmoIndex1()),m_vLastSeeEnemyBlastWaypoint)); // first - throw
				pSched->addTask(new CFindPathTask(pWaypoint->getOrigin())); // 2nd -- hide
				m_pSchedules->add(pSched);
				return true;
			}

		}
	case BOT_UTIL_SNIPE:
		{
			// roam
			CWaypoint *pWaypoint = CWaypoints::randomWaypointGoal(CWaypointTypes::W_FL_SNIPER);

			if ( pWaypoint )
			{
				CBotSchedule *snipe = new CBotSchedule();
				CBotTask *findpath = new CFindPathTask(CWaypoints::getWaypointIndex(pWaypoint));
				CBotTask *snipetask;

				// use DOD task
				snipetask = new CBotHL2DMSnipe(m_pWeapons->getWeapon(CWeapons::getWeapon(HL2DM_WEAPON_CROSSBOW)),pWaypoint->getOrigin(),pWaypoint->getAimYaw(),false,0);

				findpath->setCompleteInterrupt(CONDITION_PUSH);
				snipetask->setCompleteInterrupt(CONDITION_PUSH);

				snipe->setID(SCHED_DEFENDPOINT);
				snipe->addTask(findpath);
				snipe->addTask(snipetask);
				
				m_pSchedules->add(snipe);

				return true;
			}

			break;
		}
	case BOT_UTIL_ROAM:
		// roam
		CWaypoint *pWaypoint = CWaypoints::getWaypoint(CWaypoints::randomFlaggedWaypoint(getTeam()));

		if ( pWaypoint )
		{
			m_pSchedules->add(new CBotGotoOriginSched(pWaypoint->getOrigin()));
			return true;
		}

		break;
	}

	return false;
}
开发者ID:Deathreus,项目名称:AFKBot,代码行数:101,代码来源:bot_hldm_bot.cpp


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