本文整理汇总了C++中CAI_BaseNPC::SetLocalAngles方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_BaseNPC::SetLocalAngles方法的具体用法?C++ CAI_BaseNPC::SetLocalAngles怎么用?C++ CAI_BaseNPC::SetLocalAngles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_BaseNPC
的用法示例。
在下文中一共展示了CAI_BaseNPC::SetLocalAngles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FinishLagCompensation
void CLagCompensationManager::FinishLagCompensation( CBasePlayer *player )
{
VPROF_BUDGET_FLAGS( "FinishLagCompensation", VPROF_BUDGETGROUP_OTHER_NETWORKING, BUDGETFLAG_CLIENT|BUDGETFLAG_SERVER );
m_pCurrentPlayer = NULL;
if ( !m_bNeedToRestore )
return; // no player was changed at all
// Iterate all active players
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
int pl_index = i - 1;
if ( !m_RestorePlayer.Get( pl_index ) )
{
// player wasn't changed by lag compensation
continue;
}
CBasePlayer *pPlayer = UTIL_PlayerByIndex( i );
if ( !pPlayer )
{
continue;
}
LagRecord *restore = &m_RestoreData[ pl_index ];
LagRecord *change = &m_ChangeData[ pl_index ];
bool restoreSimulationTime = false;
if ( restore->m_fFlags & LC_SIZE_CHANGED )
{
restoreSimulationTime = true;
// see if simulation made any changes, if no, then do the restore, otherwise,
// leave new values in
if ( pPlayer->CollisionProp()->OBBMinsPreScaled() == change->m_vecMinsPreScaled &&
pPlayer->CollisionProp()->OBBMaxsPreScaled() == change->m_vecMaxsPreScaled )
{
// Restore it
pPlayer->SetSize( restore->m_vecMinsPreScaled, restore->m_vecMaxsPreScaled );
}
else
{
Warning( "Should we really not restore the size?\n" );
}
}
if ( restore->m_fFlags & LC_ANGLES_CHANGED )
{
restoreSimulationTime = true;
if ( pPlayer->GetLocalAngles() == change->m_vecAngles )
{
pPlayer->SetLocalAngles( restore->m_vecAngles );
}
}
if ( restore->m_fFlags & LC_ORIGIN_CHANGED )
{
restoreSimulationTime = true;
// Okay, let's see if we can do something reasonable with the change
Vector delta = pPlayer->GetLocalOrigin() - change->m_vecOrigin;
// If it moved really far, just leave the player in the new spot!!!
if ( delta.Length2DSqr() < m_flTeleportDistanceSqr )
{
RestorePlayerTo( pPlayer, restore->m_vecOrigin + delta );
}
}
if( restore->m_fFlags & LC_ANIMATION_CHANGED )
{
restoreSimulationTime = true;
pPlayer->SetSequence(restore->m_masterSequence);
pPlayer->SetCycle(restore->m_masterCycle);
int layerCount = pPlayer->GetNumAnimOverlays();
for( int layerIndex = 0; layerIndex < layerCount; ++layerIndex )
{
CAnimationLayer *currentLayer = pPlayer->GetAnimOverlay(layerIndex);
if( currentLayer )
{
currentLayer->m_flCycle = restore->m_layerRecords[layerIndex].m_cycle;
currentLayer->m_nOrder = restore->m_layerRecords[layerIndex].m_order;
currentLayer->m_nSequence = restore->m_layerRecords[layerIndex].m_sequence;
currentLayer->m_flWeight = restore->m_layerRecords[layerIndex].m_weight;
}
}
}
if ( restoreSimulationTime )
{
pPlayer->SetSimulationTime( restore->m_flSimulationTime );
}
}
//.........这里部分代码省略.........
示例2: SpawnTroops
void CNPC_CombineDropship::SpawnTroops( void )
{
int i;
// char szAttachmentName[ 32 ];
Vector vecLocation;
QAngle vecAngles;
QAngle vecSpawnAngles;
// memset( szAttachmentName, 0, 32 );
vecSpawnAngles = GetLocalAngles();
vecSpawnAngles.y = UTIL_AngleMod( vecSpawnAngles.y - 180 );
vecSpawnAngles.x = 0;
vecSpawnAngles.z = 0;
for( i = 1 ; i <= m_soldiersToDrop ; i++ )
{
// Q_snprintf( szAttachmentName,sizeof(szAttachmentName), "spot%d", i );
// GetAttachment( szAttachmentName, vecLocation, vecAngles );
vecLocation = GetAbsOrigin();
vecAngles = GetAbsAngles();
// troops spawn behind vehicle at all times
Vector shipDir, shipLeft;
AngleVectors( vecAngles, &shipDir, &shipLeft, NULL );
vecLocation -= shipDir * 250;
// set spawn position for spawning in formation
switch( i )
{
case 1:
vecLocation -= shipLeft * DROPSHIP_TROOP_GRID;
break;
case 3:
vecLocation += shipLeft * DROPSHIP_TROOP_GRID;
break;
case 4:
vecLocation -= shipDir * DROPSHIP_TROOP_GRID - shipLeft * DROPSHIP_TROOP_GRID;
break;
case 5:
vecLocation -= shipDir * DROPSHIP_TROOP_GRID;
break;
case 6:
vecLocation -= shipDir * DROPSHIP_TROOP_GRID + shipLeft * DROPSHIP_TROOP_GRID;
}
// spawn based upon template
CAI_BaseNPC *pEnt = NULL;
CBaseEntity *pEntity = NULL;
MapEntity_ParseEntity( pEntity, STRING(m_sNPCTemplateData), NULL );
if ( pEntity != NULL )
{
pEnt = (CAI_BaseNPC *)pEntity;
}
else
{
Warning("Dropship could not create template NPC\n" );
return;
}
pEnt->SetLocalOrigin( vecLocation );
pEnt->SetLocalAngles( vecSpawnAngles );
DispatchSpawn( pEnt );
pEnt->m_NPCState = NPC_STATE_IDLE;
pEnt->SetOwnerEntity( this );
pEnt->Activate();
}
}