本文整理汇总了C++中CFindPathTask类的典型用法代码示例。如果您正苦于以下问题:C++ CFindPathTask类的具体用法?C++ CFindPathTask怎么用?C++ CFindPathTask使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFindPathTask类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Vector
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();
}
示例2: CFindPathTask
CBotTF2HealSched::CBotTF2HealSched(edict_t *pHeal)
{
CFindPathTask *findpath = new CFindPathTask(pHeal);
findpath->SetCompleteInterrupt(CONDITION_SEE_HEAL);
AddTask(findpath);
AddTask(new CBotTF2MedicHeal());
}
示例3: executeAction
// from the bots UTILITIES , execute the given action
bool CHLDMBot :: executeAction ( eBotAction iAction )
{
switch ( iAction )
{
case BOT_UTIL_HL2DM_USE_CRATE:
// check if it is worth it first
{
const char *szModel;
char type;
CBotWeapon *pWeapon = NULL;
/*
possible models
0000000000111111111122222222223333
0123456789012345678901234567890123
models/items/ammocrate_ar2.mdl
models/items/ammocrate_grenade.mdl
models/items/ammocrate_rockets.mdl
models/items/ammocrate_smg1.mdl
*/
szModel = m_pAmmoCrate.get()->GetIServerEntity()->GetModelName().ToCStr();
type = szModel[23];
if ( type == 'a' ) // ar2
{
pWeapon = m_pWeapons->getWeapon(CWeapons::getWeapon(HL2DM_WEAPON_AR2));
}
else if ( type == 'g' ) // grenade
{
pWeapon = m_pWeapons->getWeapon(CWeapons::getWeapon(HL2DM_WEAPON_FRAG));
}
else if ( type == 'r' ) // rocket
{
pWeapon = m_pWeapons->getWeapon(CWeapons::getWeapon(HL2DM_WEAPON_RPG));
}
else if ( type == 's' ) // smg
{
pWeapon = m_pWeapons->getWeapon(CWeapons::getWeapon(HL2DM_WEAPON_SMG1));
}
if ( pWeapon && (pWeapon->getAmmo(this) < 1) )
{
CBotSchedule *pSched = new CBotSchedule();
pSched->addTask(new CFindPathTask(m_pAmmoCrate));
pSched->addTask(new CBotHL2DMUseButton(m_pAmmoCrate));
m_pSchedules->add(pSched);
m_fUtilTimes[iAction] = engine->Time() + randomFloat(5.0f,10.0f);
return true;
}
}
return false;
case BOT_UTIL_PICKUP_WEAPON:
m_pSchedules->add(new CBotPickupSched(m_pNearbyWeapon.get()));
return true;
case BOT_UTIL_FIND_NEAREST_HEALTH:
m_pSchedules->add(new CBotPickupSched(m_pHealthKit.get()));
return true;
case BOT_UTIL_HL2DM_FIND_ARMOR:
m_pSchedules->add(new CBotPickupSched(m_pBattery.get()));
return true;
case BOT_UTIL_FIND_NEAREST_AMMO:
m_pSchedules->add(new CBotPickupSched(m_pAmmoKit.get()));
m_fUtilTimes[iAction] = engine->Time() + randomFloat(5.0f,10.0f);
return true;
case BOT_UTIL_HL2DM_USE_HEALTH_CHARGER:
{
CBotSchedule *pSched = new CBotSchedule();
pSched->addTask(new CFindPathTask(m_pHealthCharger));
pSched->addTask(new CBotHL2DMUseCharger(m_pHealthCharger,CHARGER_HEALTH));
m_pSchedules->add(pSched);
m_fUtilTimes[BOT_UTIL_HL2DM_USE_HEALTH_CHARGER] = engine->Time() + randomFloat(5.0f,10.0f);
return true;
}
case BOT_UTIL_HL2DM_USE_CHARGER:
{
CBotSchedule *pSched = new CBotSchedule();
pSched->addTask(new CFindPathTask(m_pCharger));
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;
}
//.........这里部分代码省略.........