本文整理汇总了C++中NPC_MoveToGoal函数的典型用法代码示例。如果您正苦于以下问题:C++ NPC_MoveToGoal函数的具体用法?C++ NPC_MoveToGoal怎么用?C++ NPC_MoveToGoal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NPC_MoveToGoal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: MineMonster_Patrol
/*
-------------------------
MineMonster_Patrol
-------------------------
*/
void MineMonster_Patrol( void )
{
NPCInfo->localState = LSTATE_CLEAR;
//If we have somewhere to go, then do that
if ( UpdateGoal() )
{
ucmd.buttons &= ~BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
}
vec3_t dif;
VectorSubtract( g_entities[0].currentOrigin, NPC->currentOrigin, dif );
if ( VectorLengthSquared( dif ) < 256 * 256 )
{
G_SetEnemy( NPC, &g_entities[0] );
}
if ( NPC_CheckEnemyExt( qtrue ) == qfalse )
{
MineMonster_Idle();
return;
}
}
开发者ID:Arbixal,项目名称:OpenJK,代码行数:30,代码来源:AI_MineMonster.cpp
示例2: Mark2_Patrol
/*
-------------------------
Mark2_Patrol
-------------------------
*/
void Mark2_Patrol( void )
{
if ( NPC_CheckPlayerTeamStealth() )
{
NPC_UpdateAngles( qtrue, qtrue );
return;
}
//If we have somewhere to go, then do that
if (!NPC->enemy)
{
if ( UpdateGoal() )
{
ucmd.buttons |= BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
NPC_UpdateAngles( qtrue, qtrue );
}
//randomly talk
if (TIMER_Done(NPC,"patrolNoise"))
{
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
}
开发者ID:NoahBennet,项目名称:base_enhanced,代码行数:30,代码来源:NPC_AI_Mark2.c
示例3: GM_Move
/*
-------------------------
GM_Move
-------------------------
*/
static qboolean GM_Move( void )
{
NPCInfo->combatMove = qtrue;//always bMove straight toward our goal
qboolean moved = NPC_MoveToGoal( qtrue );
navInfo_t info;
//Get the bMove info
NAV_GetLastMove( info );
//FIXME: if we bump into another one of our guys and can't get around him, just stop!
//If we hit our target, then stop and fire!
if ( info.flags & NIF_COLLISION )
{
if ( info.blocker == NPC->enemy )
{
GM_HoldPosition();
}
}
//If our bMove failed, then reset
if ( moved == qfalse )
{//FIXME: if we're going to a combat point, need to pick a different one
if ( !Q3_TaskIDPending( NPC, TID_MOVE_NAV ) )
{//can't transfer movegoal or stop when a script we're running is waiting to complete
GM_HoldPosition();
}
}
return moved;
}
开发者ID:PJayB,项目名称:jk2src,代码行数:36,代码来源:AI_GalakMech.cpp
示例4: Mark2_Patrol
/*
-------------------------
Mark2_Patrol
-------------------------
*/
void Mark2_Patrol( void )
{
if ( NPC_CheckPlayerTeamStealth() )
{
// G_Sound( NPC, G_SoundIndex("sound/chars/mark1/misc/anger.wav"));
NPC_UpdateAngles( qtrue, qtrue );
return;
}
//If we have somewhere to go, then do that
if (!NPC->enemy)
{
if ( UpdateGoal() )
{
ucmd.buttons |= BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
NPC_UpdateAngles( qtrue, qtrue );
}
//randomly talk
if (TIMER_Done(NPC,"patrolNoise"))
{
// G_Sound( NPC, G_SoundIndex(va("sound/chars/mark1/misc/talk%d.wav", Q_irand(1, 4))));
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
}
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:33,代码来源:NPC_AI_Mark2.cpp
示例5: Howler_Patrol
/*
-------------------------
Howler_Patrol
-------------------------
*/
void Howler_Patrol( void )
{
vector3 dif;
NPCInfo->localState = LSTATE_CLEAR;
//If we have somewhere to go, then do that
if ( UpdateGoal() )
{
ucmd.buttons &= ~BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
}
else
{
if ( TIMER_Done( NPC, "patrolTime" ))
{
TIMER_Set( NPC, "patrolTime", crandom() * 5000 + 5000 );
}
}
//rwwFIXMEFIXME: Care about all clients, not just client 0
VectorSubtract( &g_entities[0].r.currentOrigin, &NPC->r.currentOrigin, &dif );
if ( VectorLengthSquared( &dif ) < 256 * 256 )
{
G_SetEnemy( NPC, &g_entities[0] );
}
if ( NPC_CheckEnemyExt( qtrue ) == qfalse )
{
Howler_Idle();
return;
}
}
开发者ID:Geptun,项目名称:japp,代码行数:39,代码来源:NPC_AI_Howler.c
示例6: NPC_BSCinematic
void NPC_BSCinematic( void )
{
if( NPCInfo->scriptFlags & SCF_FIRE_WEAPON )
{
WeaponThink( qtrue );
}
if ( UpdateGoal() )
{//have a goalEntity
//move toward goal, should also face that goal
NPC_MoveToGoal( qtrue );
}
if ( NPCInfo->watchTarget )
{//have an entity which we want to keep facing
//NOTE: this will override any angles set by NPC_MoveToGoal
vec3_t eyes, viewSpot, viewvec, viewangles;
CalcEntitySpot( NPC, SPOT_HEAD_LEAN, eyes );
CalcEntitySpot( NPCInfo->watchTarget, SPOT_HEAD_LEAN, viewSpot );
VectorSubtract( viewSpot, eyes, viewvec );
vectoangles( viewvec, viewangles );
NPCInfo->lockedDesiredYaw = NPCInfo->desiredYaw = viewangles[YAW];
NPCInfo->lockedDesiredPitch = NPCInfo->desiredPitch = viewangles[PITCH];
}
NPC_UpdateAngles( qtrue, qtrue );
}
开发者ID:Chedo,项目名称:OpenJK,代码行数:32,代码来源:NPC_behavior.cpp
示例7: Rancor_Patrol
/*
-------------------------
Rancor_Patrol
-------------------------
*/
void Rancor_Patrol( void )
{
NPCS.NPCInfo->localState = LSTATE_CLEAR;
//If we have somewhere to go, then do that
if ( UpdateGoal() )
{
NPCS.ucmd.buttons &= ~BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
}
else
{
if ( TIMER_Done( NPCS.NPC, "patrolTime" ))
{
TIMER_Set( NPCS.NPC, "patrolTime", crandom() * 5000 + 5000 );
}
}
if ( NPC_CheckEnemyExt( qtrue ) == qfalse )
{
Rancor_Idle();
return;
}
Rancor_CheckRoar( NPCS.NPC );
TIMER_Set( NPCS.NPC, "lookForNewEnemy", Q_irand( 5000, 15000 ) );
}
开发者ID:Almightygir,项目名称:OpenJK,代码行数:31,代码来源:NPC_AI_Rancor.c
示例8: ImperialProbe_Patrol
void ImperialProbe_Patrol( void ) {
ImperialProbe_MaintainHeight();
if ( NPC_CheckPlayerTeamStealth() ) {
NPC_UpdateAngles( qtrue, qtrue );
return;
}
//If we have somewhere to go, then do that
if ( !NPC->enemy ) {
NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_RUN1, SETANIM_FLAG_NORMAL );
if ( UpdateGoal() ) {
//start loop sound once we move
NPC->s.loopSound = G_SoundIndex( "sound/chars/probe/misc/probedroidloop" );
ucmd.buttons |= BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
}
//randomly talk
if ( TIMER_Done( NPC, "patrolNoise" ) ) {
G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/probe/misc/probetalk%d", Q_irand( 1, 3 ) ) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
else // He's got an enemy. Make him angry.
{
G_SoundOnEnt( NPC, CHAN_AUTO, "sound/chars/probe/misc/anger1" );
TIMER_Set( NPC, "angerNoise", Q_irand( 2000, 4000 ) );
//NPCInfo->behaviorState = BS_HUNT_AND_KILL;
}
NPC_UpdateAngles( qtrue, qtrue );
}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:34,代码来源:NPC_AI_ImperialProbe.cpp
示例9: NPC_Sentry_Patrol
/*
-------------------------
NPC_Sentry_Patrol
-------------------------
*/
void NPC_Sentry_Patrol( void ) {
Sentry_MaintainHeight();
//If we have somewhere to go, then do that
if ( !NPC->enemy ) {
if ( NPC_CheckPlayerTeamStealth() ) {
//NPC_AngerSound();
NPC_UpdateAngles( qtrue, qtrue );
return;
}
if ( UpdateGoal() ) {
//start loop sound once we move
ucmd.buttons |= BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
}
//randomly talk
if ( TIMER_Done( NPC, "patrolNoise" ) ) {
G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/sentry/misc/talk%d", Q_irand( 1, 3 ) ) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
NPC_UpdateAngles( qtrue, qtrue );
}
开发者ID:redsaurus,项目名称:japp,代码行数:32,代码来源:NPC_AI_Sentry.c
示例10: Howler_Patrol
/*
-------------------------
Howler_Patrol
-------------------------
*/
void Howler_Patrol( void )
{
NPCInfo->localState = LSTATE_CLEAR;
//If we have somewhere to go, then do that
if ( UpdateGoal() )
{
ucmd.buttons &= ~BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
}
else
{
if ( TIMER_Done( NPC, "patrolTime" ))
{
TIMER_Set( NPC, "patrolTime", crandom() * 5000 + 5000 );
}
}
vec3_t dif;
VectorSubtract( g_entities[0].currentOrigin, NPC->currentOrigin, dif );
if ( VectorLengthSquared( dif ) < 256 * 256 )
{
G_SetEnemy( NPC, &g_entities[0] );
}
if ( NPC_CheckEnemyExt( qtrue ) == qfalse )
{
Howler_Idle();
return;
}
}
开发者ID:slaytan1c,项目名称:jedioutcast,代码行数:38,代码来源:AI_Howler.cpp
示例11: MineMonster_Patrol
/*
-------------------------
MineMonster_Patrol
-------------------------
*/
void MineMonster_Patrol( void )
{
vec3_t dif;
NPCS.NPCInfo->localState = LSTATE_CLEAR;
//If we have somewhere to go, then do that
if ( UpdateGoal() )
{
NPCS.ucmd.buttons &= ~BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
}
else
{
if ( TIMER_Done( NPCS.NPC, "patrolTime" ))
{
TIMER_Set( NPCS.NPC, "patrolTime", Q_flrand(-1.0f, 1.0f) * 5000 + 5000 );
}
}
//rwwFIXMEFIXME: Care about all clients, not just client 0
//OJKFIXME: clietnum 0
VectorSubtract( g_entities[0].r.currentOrigin, NPCS.NPC->r.currentOrigin, dif );
if ( VectorLengthSquared( dif ) < 256 * 256 )
{
G_SetEnemy( NPCS.NPC, &g_entities[0] );
}
if ( NPC_CheckEnemyExt( qtrue ) == qfalse )
{
MineMonster_Idle();
return;
}
}
开发者ID:Avygeil,项目名称:NewJK,代码行数:40,代码来源:NPC_AI_MineMonster.c
示例12: Droid_Run
/*
-------------------------
Droid_Run
-------------------------
*/
void Droid_Run( void )
{
R2D2_PartsMove();
if ( NPCInfo->localState == LSTATE_BACKINGUP )
{
ucmd.forwardmove = -127;
NPCInfo->desiredYaw += 5;
NPCInfo->localState = LSTATE_NONE; // So he doesn't constantly backup.
}
else
{
ucmd.forwardmove = 64;
//If we have somewhere to go, then do that
if ( UpdateGoal() )
{
if (NPC_MoveToGoal( qfalse ))
{
NPCInfo->desiredYaw += sin(level.time*.5) * 5; // Weaves side to side a little
}
}
}
NPC_UpdateAngles( qtrue, qtrue );
}
开发者ID:DarthFutuza,项目名称:JediKnightGalaxies,代码行数:31,代码来源:NPC_AI_Droid.cpp
示例13: MineMonster_Idle
/*
-------------------------
MineMonster_Idle
-------------------------
*/
void MineMonster_Idle( void )
{
if ( UpdateGoal() )
{
ucmd.buttons &= ~BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
}
}
开发者ID:Arbixal,项目名称:OpenJK,代码行数:13,代码来源:AI_MineMonster.cpp
示例14: Rancor_Idle
void Rancor_Idle( void ) {
NPCInfo->localState = LSTATE_CLEAR;
//If we have somewhere to go, then do that
if ( UpdateGoal() ) {
ucmd.buttons &= ~BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
}
}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:9,代码来源:NPC_AI_Rancor.cpp
示例15: MineMonster_Move
/*
-------------------------
MineMonster_Move
-------------------------
*/
void MineMonster_Move( qboolean visible )
{
if ( NPCInfo->localState != LSTATE_WAITING )
{
NPCInfo->goalEntity = NPC->enemy;
NPC_MoveToGoal( qtrue );
NPCInfo->goalRadius = MAX_DISTANCE; // just get us within combat range
}
}
开发者ID:Arbixal,项目名称:OpenJK,代码行数:14,代码来源:AI_MineMonster.cpp
示例16: NPC_BSReaver_Idle
void NPC_BSReaver_Idle( void )
{
//See if we have a goal to run to
if ( UpdateGoal() )
{
NPC_MoveToGoal();
}
NPC_UpdateAngles( qfalse, qtrue );
}
开发者ID:UberGames,项目名称:SP-Mod-Source-Code,代码行数:10,代码来源:AI_Reaver.cpp
示例17: SandCreature_Move
qboolean SandCreature_Move( void )
{
qboolean moved = qfalse;
//FIXME should ignore doors..?
vec3_t dest;
VectorCopy( NPCInfo->goalEntity->currentOrigin, dest );
//Sand Creatures look silly using waypoints when they can go straight to the goal
if ( SandCreature_CheckAhead( dest ) )
{//use our temp move straight to goal check
VectorSubtract( dest, NPC->currentOrigin, NPC->client->ps.moveDir );
NPC->client->ps.speed = VectorNormalize( NPC->client->ps.moveDir );
if ( (ucmd.buttons&BUTTON_WALKING) && NPC->client->ps.speed > NPCInfo->stats.walkSpeed )
{
NPC->client->ps.speed = NPCInfo->stats.walkSpeed;
}
else
{
if ( NPC->client->ps.speed < NPCInfo->stats.walkSpeed )
{
NPC->client->ps.speed = NPCInfo->stats.walkSpeed;
}
if ( !(ucmd.buttons&BUTTON_WALKING) && NPC->client->ps.speed < NPCInfo->stats.runSpeed )
{
NPC->client->ps.speed = NPCInfo->stats.runSpeed;
}
else if ( NPC->client->ps.speed > NPCInfo->stats.runSpeed )
{
NPC->client->ps.speed = NPCInfo->stats.runSpeed;
}
}
moved = qtrue;
}
else
{
moved = NPC_MoveToGoal( qtrue );
}
if ( moved && NPC->radius )
{
vec3_t newPos;
float curTurfRange, newTurfRange;
curTurfRange = DistanceHorizontal( NPC->currentOrigin, NPC->s.origin );
VectorMA( NPC->currentOrigin, NPC->client->ps.speed/100.0f, NPC->client->ps.moveDir, newPos );
newTurfRange = DistanceHorizontal( newPos, NPC->s.origin );
if ( newTurfRange > NPC->radius && newTurfRange > curTurfRange )
{//would leave our range
//stop
NPC->client->ps.speed = 0.0f;
VectorClear( NPC->client->ps.moveDir );
ucmd.forwardmove = ucmd.rightmove = 0;
moved = qfalse;
}
}
return (moved);
//often erroneously returns false ??? something wrong with NAV...?
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:55,代码来源:AI_SandCreature.cpp
示例18: Droid_Patrol
void Droid_Patrol( void ) {
NPC->pos1.yaw = AngleNormalize360( NPC->pos1.yaw );
if ( NPC->client && NPC->client->NPC_class != CLASS_GONK ) {
if ( NPC->client->NPC_class != CLASS_R5D2 ) { //he doesn't have an eye.
R2D2_PartsMove(); // Get his eye moving.
}
R2D2_TurnAnims();
}
//If we have somewhere to go, then do that
if ( UpdateGoal() ) {
ucmd.buttons |= BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
if ( NPC->client && NPC->client->NPC_class == CLASS_MOUSE ) {
NPCInfo->desiredYaw += sinf( level.time*.5f ) * 25; // Weaves side to side a little
if ( TIMER_Done( NPC, "patrolNoise" ) ) {
G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/mouse/misc/mousego%d.wav", Q_irand( 1, 3 ) ) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
else if ( NPC->client && NPC->client->NPC_class == CLASS_R2D2 ) {
if ( TIMER_Done( NPC, "patrolNoise" ) ) {
G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/r2d2/misc/r2d2talk0%d.wav", Q_irand( 1, 3 ) ) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
else if ( NPC->client && NPC->client->NPC_class == CLASS_R5D2 ) {
if ( TIMER_Done( NPC, "patrolNoise" ) ) {
G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/r5d2/misc/r5talk%d.wav", Q_irand( 1, 4 ) ) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
if ( NPC->client && NPC->client->NPC_class == CLASS_GONK ) {
if ( TIMER_Done( NPC, "patrolNoise" ) ) {
G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/gonk/misc/gonktalk%d.wav", Q_irand( 1, 2 ) ) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
// else
// {
// R5D2_LookAround();
// }
}
NPC_UpdateAngles( qtrue, qtrue );
}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:55,代码来源:NPC_AI_Droid.cpp
示例19: Sniper_Move
static qboolean Sniper_Move( void )
{
qboolean moved;
navInfo_t info;
NPCInfo->combatMove = qtrue;//always move straight toward our goal
moved = NPC_MoveToGoal( qtrue );
//Get the move info
NAV_GetLastMove( &info );
//FIXME: if we bump into another one of our guys and can't get around him, just stop!
//If we hit our target, then stop and fire!
if ( info.flags & NIF_COLLISION )
{
if ( info.blocker == NPC->enemy )
{
Sniper_HoldPosition();
}
}
//If our move failed, then reset
if ( moved == qfalse )
{//couldn't get to enemy
if ( (NPCInfo->scriptFlags&SCF_CHASE_ENEMIES) && NPCInfo->goalEntity && NPCInfo->goalEntity == NPC->enemy )
{//we were running after enemy
//Try to find a combat point that can hit the enemy
int cpFlags = (CP_CLEAR|CP_HAS_ROUTE);
int cp;
if ( NPCInfo->scriptFlags&SCF_USE_CP_NEAREST )
{
cpFlags &= ~(CP_FLANK|CP_APPROACH_ENEMY|CP_CLOSEST);
cpFlags |= CP_NEAREST;
}
cp = NPC_FindCombatPoint( NPC->r.currentOrigin, NPC->r.currentOrigin, NPC->r.currentOrigin, cpFlags, 32, -1 );
if ( cp == -1 && !(NPCInfo->scriptFlags&SCF_USE_CP_NEAREST) )
{//okay, try one by the enemy
cp = NPC_FindCombatPoint( NPC->r.currentOrigin, NPC->r.currentOrigin, NPC->enemy->r.currentOrigin, CP_CLEAR|CP_HAS_ROUTE|CP_HORZ_DIST_COLL, 32, -1 );
}
//NOTE: there may be a perfectly valid one, just not one within CP_COLLECT_RADIUS of either me or him...
if ( cp != -1 )
{//found a combat point that has a clear shot to enemy
NPC_SetCombatPoint( cp );
NPC_SetMoveGoal( NPC, level.combatPoints[cp].origin, 8, qtrue, cp, NULL );
return moved;
}
}
//just hang here
Sniper_HoldPosition();
}
return moved;
}
开发者ID:jwginge,项目名称:ojpa,代码行数:54,代码来源:NPC_AI_Sniper.c
示例20: Mark2_Hunt
void Mark2_Hunt( void ) {
if ( NPCInfo->goalEntity == NULL ) {
NPCInfo->goalEntity = NPC->enemy;
}
// Turn toward him before moving towards him.
NPC_FaceEnemy( qtrue );
NPCInfo->combatMove = qtrue;
NPC_MoveToGoal( qtrue );
}
开发者ID:Arcadiaprime,项目名称:japp,代码行数:11,代码来源:NPC_AI_Mark2.cpp
注:本文中的NPC_MoveToGoal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论