本文整理汇总了C++中NPC_MoveToGoal函数的典型用法代码示例。如果您正苦于以下问题:C++ NPC_MoveToGoal函数的具体用法?C++ NPC_MoveToGoal怎么用?C++ NPC_MoveToGoal使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NPC_MoveToGoal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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 ) );
}
}
}
示例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;
}
示例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 ) );
}
}
}
示例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;
}
}
示例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 );
}
示例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 ) );
}
示例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 );
}
示例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 );
}
示例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;
}
}
示例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;
}
}
示例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 );
}
示例13: MineMonster_Idle
/*
-------------------------
MineMonster_Idle
-------------------------
*/
void MineMonster_Idle( void )
{
if ( UpdateGoal() )
{
ucmd.buttons &= ~BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
}
}
示例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 );
}
}
示例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
}
}