本文整理汇总了C++中CAmmoDef::Index方法的典型用法代码示例。如果您正苦于以下问题:C++ CAmmoDef::Index方法的具体用法?C++ CAmmoDef::Index怎么用?C++ CAmmoDef::Index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAmmoDef
的用法示例。
在下文中一共展示了CAmmoDef::Index方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FireGun
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPropAirboat::FireGun( void )
{
// Trace from eyes and see what we hit.
Vector vecEyeDirection;
m_hPlayer->EyeVectors( &vecEyeDirection, NULL, NULL );
Vector vecEndPos = m_hPlayer->EyePosition() + ( vecEyeDirection * MAX_TRACE_LENGTH );
trace_t trace;
UTIL_TraceLine( m_hPlayer->EyePosition(), vecEndPos, MASK_SHOT, this, COLLISION_GROUP_NONE, &trace );
if ( trace.m_pEnt )
{
// Get the gun position.
Vector vecGunPosition;
QAngle vecGunAngles;
GetAttachment( LookupAttachment( "gun_barrel" ), vecGunPosition, vecGunAngles );
// Get a ray from the gun to the target.
Vector vecRay = trace.endpos - vecGunPosition;
VectorNormalize( vecRay );
CAmmoDef *pAmmoDef = GetAmmoDef();
int ammoType = pAmmoDef->Index( "MediumRound" );
FireBullets( 1, vecGunPosition, vecRay, vec3_origin, 4096, ammoType );
}
}
示例2: GetAmmoDef
CAmmoDef* GetAmmoDef()
{
static CAmmoDef def;
static bool bInitted = false;
if ( !bInitted )
{
bInitted = true;
// Start at 1 here and skip the dummy ammo type to make CAmmoDef use the same indices
// as our #defines.
for ( int i=1; i < TFC_NUM_AMMO_TYPES; i++ )
{
def.AddAmmoType( g_AmmoTypeNames[i], DMG_BULLET, TRACER_LINE, 0, 0, "ammo_max", 2400, 10, 14 );
Assert( def.Index( g_AmmoTypeNames[i] ) == i );
}
}
return &def;
}
示例3: Spawn
//------------------------------------------------
// Spawn
//------------------------------------------------
void CASW_PropJeep::Spawn( void )
{
// Setup vehicle as a real-wheels car.
SetVehicleType( VEHICLE_TYPE_CAR_WHEELS );
BaseClass::Spawn();
m_flHandbrakeTime = gpGlobals->curtime + 0.1;
m_bInitialHandbrake = false;
m_flMinimumSpeedToEnterExit = LOCK_SPEED;
m_nBulletType = GetAmmoDef()->Index("GaussEnergy");
if ( m_bHasGun )
{
SetBodygroup( 1, true );
}
else
{
SetBodygroup( 1, false );
}
// Initialize pose parameters
SetPoseParameter( JEEP_GUN_YAW, 0 );
SetPoseParameter( JEEP_GUN_PITCH, 0 );
m_nSpinPos = 0;
SetPoseParameter( JEEP_GUN_SPIN, m_nSpinPos );
m_aimYaw = 0;
m_aimPitch = 0;
AddSolidFlags( FSOLID_NOT_STANDABLE );
CAmmoDef *pAmmoDef = GetAmmoDef();
m_nAmmoType = pAmmoDef->Index("GaussEnergy");
// normal HL2 vehicles don't feel nice in a network game
// so destroy ourselves and spawn the serverside component of our custom ASW client authorative vehicle system
}
示例4: Spawn
//------------------------------------------------
// Spawn
//------------------------------------------------
void CPropJeep::Spawn( void )
{
// Setup vehicle as a real-wheels car.
SetVehicleType( VEHICLE_TYPE_CAR_WHEELS );
BaseClass::Spawn();
m_flHandbrakeTime = gpGlobals->curtime + 0.1;
m_bInitialHandbrake = false;
m_VehiclePhysics.SetHasBrakePedal( false );
m_flMinimumSpeedToEnterExit = LOCK_SPEED;
m_nBulletType = GetAmmoDef()->Index("GaussEnergy");
if ( m_bHasGun )
{
SetBodygroup( 1, true );
}
else
{
SetBodygroup( 1, false );
}
// Initialize pose parameters
SetPoseParameter( JEEP_GUN_YAW, 0 );
SetPoseParameter( JEEP_GUN_PITCH, 0 );
m_nSpinPos = 0;
SetPoseParameter( JEEP_GUN_SPIN, m_nSpinPos );
m_aimYaw = 0;
m_aimPitch = 0;
AddSolidFlags( FSOLID_NOT_STANDABLE );
CAmmoDef *pAmmoDef = GetAmmoDef();
m_nAmmoType = pAmmoDef->Index("GaussEnergy");
}