• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FireBullets函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FireBullets函数的典型用法代码示例。如果您正苦于以下问题:C++ FireBullets函数的具体用法?C++ FireBullets怎么用?C++ FireBullets使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FireBullets函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: switch

void CFuncTankGun::Fire( int bulletCount, const Vector &barrelEnd, const Vector &forward, CBaseEntity *pAttacker )
{
	int i;

	for ( i = 0; i < bulletCount; i++ )
	{
		switch( m_bulletType )
		{
		case TANK_BULLET_SMALL:
			FireBullets( 1, barrelEnd, forward, gTankSpread[m_spread], MAX_TRACE_LENGTH, m_iSmallAmmoType, 1,  -1, -1, m_iBulletDamage, pAttacker );
			break;

		case TANK_BULLET_MEDIUM:
			FireBullets( 1, barrelEnd, forward, gTankSpread[m_spread], MAX_TRACE_LENGTH, m_iMediumAmmoType, 1, -1, -1, m_iBulletDamage, pAttacker );
			break;

		case TANK_BULLET_LARGE:
			FireBullets( 1, barrelEnd, forward, gTankSpread[m_spread], MAX_TRACE_LENGTH, m_iLargeAmmoType, 1,  -1, -1, m_iBulletDamage, pAttacker );
			break;
		default:
		case TANK_BULLET_NONE:
			break;
		}
	}
	CFuncTank::Fire( bulletCount, barrelEnd, forward, pAttacker );
}
开发者ID:AgentAgrimar,项目名称:source-sdk-trilogy,代码行数:26,代码来源:hl1_func_tank.cpp


示例2: UTIL_MakeAimVectors

void CFuncTankGun::Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker)
{
	if (m_fireLast != 0)
	{
		UTIL_MakeAimVectors(pev->angles);

		int bulletCount = (int)((gpGlobals->time - m_fireLast) * m_fireRate);

		if (bulletCount > 0)
		{
			for (int i = 0; i < bulletCount; i++)
			{
				switch (m_bulletType)
				{
					case TANK_BULLET_9MM: FireBullets(1, barrelEnd, forward, gTankSpread[m_spread], 4096, BULLET_MONSTER_9MM, 1, m_iBulletDamage, pevAttacker); break;
					case TANK_BULLET_MP5: FireBullets(1, barrelEnd, forward, gTankSpread[m_spread], 4096, BULLET_MONSTER_MP5, 1, m_iBulletDamage, pevAttacker); break;
					case TANK_BULLET_12MM: FireBullets(1, barrelEnd, forward, gTankSpread[m_spread], 4096, BULLET_MONSTER_12MM, 1, m_iBulletDamage, pevAttacker); break;

					default:
					case TANK_BULLET_NONE: break;
				}
			}

			CFuncTank::Fire(barrelEnd, forward, pevAttacker);
		}
	}
	else
		CFuncTank::Fire(barrelEnd, forward, pevAttacker);
}
开发者ID:AlexCSilva,项目名称:cs16-client,代码行数:29,代码来源:func_tank.cpp


示例3: BarneyFirePistol

//=========================================================
// BarneyFirePistol - shoots one round from the pistol at
// the enemy barney is facing.
//=========================================================
void CFriend :: BarneyFirePistol ( void )
{
	Vector vecShootOrigin;

	UTIL_MakeVectors(pev->angles);
	vecShootOrigin = pev->origin + Vector( 0, 0, 55 );
	Vector vecShootDir = ShootAtEnemy( vecShootOrigin );

	Vector angDir = UTIL_VecToAngles( vecShootDir );
	SetBlending( 0, angDir.x );
	pev->effects = EF_MUZZLEFLASH;

	if (pev->frags)
	{
		FireBullets(8, vecShootOrigin, vecShootDir, VECTOR_CONE_10DEGREES, 1024, BULLET_PLAYER_BUCKSHOT);//357

		EMIT_SOUND( ENT(pev), CHAN_WEAPON, "weapons/shotgun/sbarrel1.wav", 1, ATTN_NORM );
	}
	else
	{
		FireBullets(1, vecShootOrigin, vecShootDir, VECTOR_CONE_2DEGREES, 1024, BULLET_MONSTER_9MM );

		int pitchShift = RANDOM_LONG( 0, 20 );
	
		// Only shift about half the time
		if ( pitchShift > 10 )
			pitchShift = 0;
		else
			pitchShift -= 5;

		EMIT_SOUND( ENT(pev), CHAN_WEAPON, "weapons/m16/m16_fire-1.wav", 1, ATTN_NORM );
	}

	CSoundEnt::InsertSound ( bits_SOUND_COMBAT, pev->origin, 384, 0.3 );

	// UNDONE: Reload?
	m_cAmmoLoaded--;// take away a bullet!

	// Teh_Freak: World Lighting!
     MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
          WRITE_BYTE( TE_DLIGHT );
          WRITE_COORD( vecShootOrigin.x ); // origin
          WRITE_COORD( vecShootOrigin.y );
          WRITE_COORD( vecShootOrigin.z );
          WRITE_BYTE( 16 );     // radius
          WRITE_BYTE( 255 );     // R
          WRITE_BYTE( 255 );     // G
          WRITE_BYTE( 128 );     // B
          WRITE_BYTE( 0 );     // life * 10
          WRITE_BYTE( 0 ); // decay
     MESSAGE_END();
	// Teh_Freak: World Lighting!

	 
	CBaseEntity *pPlayer = UTIL_PlayerByIndex( 1 );
	if (pPlayer->m_fSlowMotionOn)
	CBullet::Shoot( pev, vecShootOrigin, vecShootDir * 500 );
}
开发者ID:JoelTroch,项目名称:am_src_rebirth,代码行数:62,代码来源:hgrunt_f.cpp


示例4: switch

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pEvent - 
//-----------------------------------------------------------------------------
void CNPC_Monk::HandleAnimEvent( animevent_t *pEvent )
{
	switch ( pEvent->event )
	{
		case AE_MONK_FIRE_GUN:
		{
			Vector vecShootOrigin;
			QAngle vecAngles;
			GetAttachment( "muzzle", vecShootOrigin, vecAngles );

			Vector vecShootDir = GetShootEnemyDir( vecShootOrigin );

			CPASAttenuationFilter filter2( this, "NPC_Monk.Fire" );
			EmitSound( filter2, entindex(), "NPC_Monk.Fire" );

			UTIL_Smoke( vecShootOrigin, random->RandomInt(20, 30), 10 );
			FireBullets( 1, vecShootOrigin, vecShootDir, vec3_origin, MAX_TRACE_LENGTH, m_nAmmoType, 0 );
			m_fEffects |= EF_MUZZLEFLASH;
			break;
		}

		default:
		{
			BaseClass::HandleAnimEvent( pEvent );
		}
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:31,代码来源:npc_monk.cpp


示例5: GetAttachment

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : hand - 
//-----------------------------------------------------------------------------
void CNPC_Assassin::FirePistol( int hand )
{
	if ( m_flNextShotTime > gpGlobals->curtime )
		return;

	m_flNextShotTime = gpGlobals->curtime + random->RandomFloat( 0.05f, 0.15f );

	Vector	muzzlePos;
	QAngle	muzzleAngle;

	const char *handName = ( hand ) ? "LeftMuzzle" : "RightMuzzle";

	GetAttachment( handName, muzzlePos, muzzleAngle );

	Vector	muzzleDir;
	
	if ( GetEnemy() == NULL )
	{
		AngleVectors( muzzleAngle, &muzzleDir );
	}
	else
	{
		muzzleDir = GetEnemy()->BodyTarget( muzzlePos ) - muzzlePos;
		VectorNormalize( muzzleDir );
	}

	int bulletType = GetAmmoDef()->Index( "Pistol" );

	FireBullets( 1, muzzlePos, muzzleDir, VECTOR_CONE_5DEGREES, 1024, bulletType, 2 );

	UTIL_MuzzleFlash( muzzlePos, muzzleAngle, 0.5f, 1 );

	CPASAttenuationFilter filter( this );
	EmitSound( filter, entindex(), "NPC_Assassin.ShootPistol" );
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:39,代码来源:npc_assassin.cpp


示例6: GetAttachment

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropAPC::FireMachineGun( void )
{
	if ( m_flMachineGunTime > gpGlobals->curtime )
		return;

	// If we're still firing the salvo, fire quickly
	m_iMachineGunBurstLeft--;
	if ( m_iMachineGunBurstLeft > 0 )
	{
		m_flMachineGunTime = gpGlobals->curtime + MACHINE_GUN_BURST_TIME;
	}
	else
	{
		// Reload the salvo
		m_iMachineGunBurstLeft = MACHINE_GUN_BURST_SIZE;
		m_flMachineGunTime = gpGlobals->curtime + MACHINE_GUN_BURST_PAUSE_TIME;
	}

	Vector vecMachineGunShootPos;
	Vector vecMachineGunDir;
	GetAttachment( m_nMachineGunMuzzleAttachment, vecMachineGunShootPos, &vecMachineGunDir );
	
	// Fire the round
	int	bulletType = GetAmmoDef()->Index("AR2");
	FireBullets( 1, vecMachineGunShootPos, vecMachineGunDir, VECTOR_CONE_8DEGREES, MAX_TRACE_LENGTH, bulletType, 1 );
	DoMuzzleFlash();

	EmitSound( "Weapon_AR2.Single" );
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:32,代码来源:vehicle_apc.cpp


示例7: BarneyFirePistol

//=========================================================
// BarneyFirePistol - shoots one round from the pistol at
// the enemy barney is facing.
//=========================================================
void CBarney :: BarneyFirePistol ( void )
{
	Vector vecShootOrigin;

	UTIL_MakeVectors(pev->angles);
	vecShootOrigin = pev->origin + Vector( 0, 0, 55 );
	Vector vecShootDir = ShootAtEnemy( vecShootOrigin );

	Vector angDir = UTIL_VecToAngles( vecShootDir );
	SetBlending( 0, angDir.x );
	pev->effects = EF_MUZZLEFLASH;

	FireBullets(1, vecShootOrigin, vecShootDir, VECTOR_CONE_2DEGREES, 1024, BULLET_MONSTER_9MM );
	
	int pitchShift = RANDOM_LONG( 0, 20 );
	
	// Only shift about half the time
	if ( pitchShift > 10 )
		pitchShift = 0;
	else
		pitchShift -= 5;
	EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, "barney/ba_attack2.wav", 1, ATTN_NORM, 0, 100 + pitchShift );

	CSoundEnt::InsertSound ( bits_SOUND_COMBAT, pev->origin, 384, 0.3 );

	// UNDONE: Reload?
	m_cAmmoLoaded--;// take away a bullet!
}
开发者ID:6779660,项目名称:halflife,代码行数:32,代码来源:barney.cpp


示例8: UTIL_TraceLine

//-----------------------------------------------------------------------------
// 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 );
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:28,代码来源:vehicle_airboat.cpp


示例9: GetBulletOrigin

//---------------------------------------------------------
// This starts the bullet state machine.  The actual effects
// of the bullet will happen later.  This function schedules 
// those effects.
//
// fDirectShot indicates whether the bullet is a "direct shot"
// that is - fired with the intent that it will strike the
// enemy. Otherwise, the bullet is intended to strike a 
// decoy object or nothing at all in particular.
//---------------------------------------------------------
bool CNPC_Combine_Cannon::FireBullet( const Vector &vecTarget, bool bDirectShot )
{
	Vector vecBulletOrigin = GetBulletOrigin();
	Vector vecDir = ( vecTarget - vecBulletOrigin );
	VectorNormalize( vecDir );

	FireBulletsInfo_t info;
	info.m_iShots = 1;
	info.m_iTracerFreq = 1;
	info.m_vecDirShooting = vecDir;
	info.m_vecSrc = vecBulletOrigin;
	info.m_flDistance = MAX_TRACE_LENGTH;
	info.m_pAttacker = this;
	info.m_iAmmoType = m_iAmmoType;
	info.m_iPlayerDamage = 20;
	info.m_vecSpread = Vector( 0.015f, 0.015f, 0.015f );  // medium cone

	FireBullets( info );

	EmitSound( "NPC_Combine_Cannon.FireBullet" );

	// Don't attack for a certain amount of time
	SetNextAttack( gpGlobals->curtime + GetRefireTime() );

	// Sniper had to be aiming here to fire here, so make it the cursor
	m_vecPaintCursor = vecTarget;

	LaserOff();

	return true;
}
开发者ID:SizzlingStats,项目名称:hl2sdk-ob-valve,代码行数:41,代码来源:npc_combine_cannon.cpp


示例10: FireBullets

void CCeilingTurret::Shoot(const Vector &vecSrc, const Vector &vecDirToEnemy)
{
	//NDebugOverlay::Line( vecSrc, vecSrc + vecDirToEnemy * 512, 0, 255, 255, false, 0.1 );
	FireBullets( 1, vecSrc, vecDirToEnemy, TURRET_SPREAD, TURRET_RANGE, m_iAmmoType, 1 );
	EmitSound( "CeilingTurret.Shoot" );
	
	DoMuzzleFlash();
}
开发者ID:Muini,项目名称:Nag-asw,代码行数:8,代码来源:npc_turret.cpp


示例11: FireBullets

void CNPC_Sentry::Shoot(Vector &vecSrc, Vector &vecDirToEnemy)
{
	FireBullets( 1, vecSrc, vecDirToEnemy, TURRET_SPREAD, TURRET_RANGE, m_iAmmoType, 1 );

	CPASAttenuationFilter filter( this );
	EmitSound( filter, entindex(), "Sentry.Shoot" );
	
	DoMuzzleFlash();
}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:9,代码来源:hl1_npc_turret.cpp


示例12: UpdateGameObjects

void World::Update(float dt)
{
	if(mActive == true)
	{
		UpdateGameObjects(dt);
		SpawnEnemies(dt);
		FireBullets();
		CheckCollision();
	}
}
开发者ID:NGAEVA,项目名称:2Dgame,代码行数:10,代码来源:World.cpp


示例13: EyePosition

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CNPC_GroundTurret::Shoot()
{
	FireBulletsInfo_t info;

	Vector vecSrc = EyePosition();
	Vector vecDir;

	GetVectors( &vecDir, NULL, NULL );

	for( int i = 0 ; i < 1 ; i++ )
	{
		info.m_vecSrc = vecSrc;
		
		if( i > 0 || !GetEnemy()->IsPlayer() )
		{
			// Subsequent shots or shots at non-players random
			GetVectors( &info.m_vecDirShooting, NULL, NULL );
			info.m_vecSpread = m_vecSpread;
		}
		else
		{
			// First shot is at the enemy.
			info.m_vecDirShooting = GetActualShootTrajectory( vecSrc );
			info.m_vecSpread = VECTOR_CONE_PRECALCULATED;
		}
		
		info.m_iTracerFreq = 1;
		info.m_iShots = 1;
		info.m_pAttacker = this;
		info.m_flDistance = MAX_COORD_RANGE;
		info.m_iAmmoType = m_iAmmoType;

		FireBullets( info );
	}

	// Do the AR2 muzzle flash
	CEffectData data;
	data.m_nEntIndex = entindex();
	data.m_nAttachmentIndex = LookupAttachment( "eyes" );
	data.m_flScale = 1.0f;
	data.m_fFlags = MUZZLEFLASH_COMBINE;
	DispatchEffect( "MuzzleFlash", data );

	EmitSound( "NPC_FloorTurret.ShotSounds", m_ShotSounds );

	if( IsX360() )
	{
		m_flTimeNextShoot = gpGlobals->curtime + 0.2;
	}
	else
	{
		m_flTimeNextShoot = gpGlobals->curtime + 0.09;
	}
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:56,代码来源:npc_turret_ground.cpp


示例14: FireBullets

void CMiniTurret::Shoot(Vector &vecSrc, Vector &vecDirToEnemy)
{
	FireBullets( 1, vecSrc, vecDirToEnemy, TURRET_SPREAD, TURRET_RANGE, BULLET_MONSTER_9MM, 1 );

	switch(RANDOM_LONG(0,2))
	{
	case 0: EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/hks1.wav", 1, ATTN_NORM); break;
	case 1: EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/hks2.wav", 1, ATTN_NORM); break;
	case 2: EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/hks3.wav", 1, ATTN_NORM); break;
	}
	pev->effects = pev->effects | EF_MUZZLEFLASH;
}
开发者ID:suXinjke,项目名称:HalfPayne,代码行数:12,代码来源:turret.cpp


示例15: EmitSound

//-----------------------------------------------------------------------------
// Purpose: Fire!
//-----------------------------------------------------------------------------
void CNPC_CeilingTurret::Shoot( const Vector &vecSrc, const Vector &vecDirToEnemy )
{
	if ( m_spawnflags & SF_CEILING_TURRET_OUT_OF_AMMO )
	{
		EmitSound( "NPC_FloorTurret.DryFire");
		EmitSound( "NPC_CeilingTurret.Activate" );

  		if ( RandomFloat( 0, 1 ) > 0.7 )
		{
			m_flShotTime = gpGlobals->curtime + random->RandomFloat( 0.5, 1.5 );
		}
		else
		{
			m_flShotTime = gpGlobals->curtime;
		}
		return;
	}

	FireBulletsInfo_t info;

	if ( GetEnemy() != NULL )
	{
		Vector vecDir = GetActualShootTrajectory( vecSrc );

		info.m_vecSrc = vecSrc;
		info.m_vecDirShooting = vecDir;
		info.m_iTracerFreq = 1;
		info.m_iShots = 1;
		info.m_pAttacker = this;
		info.m_vecSpread = VECTOR_CONE_PRECALCULATED;
		info.m_flDistance = MAX_COORD_RANGE;
		info.m_iAmmoType = m_iAmmoType;
	}
	else
	{
		// Just shoot where you're facing!
		Vector vecMuzzle, vecMuzzleDir;
		QAngle vecMuzzleAng;
		
		info.m_vecSrc = vecSrc;
		info.m_vecDirShooting = vecDirToEnemy;
		info.m_iTracerFreq = 1;
		info.m_iShots = 1;
		info.m_pAttacker = this;
		info.m_vecSpread = GetAttackSpread( NULL, NULL );
		info.m_flDistance = MAX_COORD_RANGE;
		info.m_iAmmoType = m_iAmmoType;
	}

	FireBullets( info );
	EmitSound( "NPC_CeilingTurret.ShotSounds" );
	DoMuzzleFlash();
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:56,代码来源:npc_turret_ceiling.cpp


示例16: GetAttachment

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropAPC2::FireMachineGun( void )
{
	if ( m_flMachineGunTime > gpGlobals->curtime )
		return;

	// If we're still firing the salvo, fire quickly
	m_iMachineGunBurstLeft--;
	if ( m_iMachineGunBurstLeft > 0 )
	{
		m_flMachineGunTime = gpGlobals->curtime + MACHINE_GUN_BURST_TIME;
	}
	else
	{
		// Reload the salvo
		m_iMachineGunBurstLeft = MACHINE_GUN_BURST_SIZE;
		m_flMachineGunTime = gpGlobals->curtime + MACHINE_GUN_BURST_PAUSE_TIME;
	}

	Vector vecMachineGunShootPos;
	QAngle vecMachineGunAngles;
	GetAttachment( m_nMachineGunMuzzleAttachment, vecMachineGunShootPos, vecMachineGunAngles );

	Vector vecMachineGunDir;
	AngleVectors( vecMachineGunAngles, &vecMachineGunDir );
	
	// Fire the round
	int	bulletType = GetAmmoDef()->Index("StriderMiniGun");
	FireBulletsInfo_t info;
		info.m_iShots = 1;
		info.m_vecSrc = vecMachineGunShootPos;
		info.m_vecDirShooting = vecMachineGunDir;
		info.m_vecSpread = VECTOR_CONE_8DEGREES;
		info.m_pAttacker =	(CBaseEntity *) m_hPlayer;
		info.m_flDistance = MAX_TRACE_LENGTH;
		info.m_iAmmoType =  bulletType;
		info.m_flDamage = 30;
		info.m_iPlayerDamage= 30;
		info.m_iTracerFreq = 1;
		FireBullets( info );
		EntityMessageBegin( this, true );
				WRITE_BYTE( APC_MSG_MACHINEGUN );
				WRITE_VEC3COORD(vecMachineGunShootPos);
				WRITE_VEC3COORD(vecMachineGunDir);
				WRITE_VEC3COORD(VECTOR_CONE_8DEGREES);
				WRITE_BYTE( bulletType );
	MessageEnd();
	DoMuzzleFlash();
	m_iAmmoCount--; 
	EmitSound( "Weapon_AR2.Single" );
}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:53,代码来源:vehicle_apc2.cpp


示例17: W_FireShotgun

/*
================
W_FireShotgun
================
*/
void W_FireShotgun()
{
	vec3_t          dir;

	sound( self, CHAN_WEAPON, "weapons/guncock.wav", 1, ATTN_NORM );

	g_globalvars.msg_entity = EDICT_TO_PROG( self );

	trap_WriteByte( MSG_ONE, SVC_SMALLKICK );

	if ( deathmatch != 4 )
		self->s.v.currentammo = --( self->s.v.ammo_shells );

	//dir = aim (self, 100000);
	aim( dir );
	FireBullets( 6, dir, 0.04, 0.04, 0 );
}
开发者ID:stayoutEE,项目名称:qwprogs-qvm,代码行数:22,代码来源:weapons.c


示例18: GetAttachment

//=========================================================
// Shoot
//=========================================================
void CNPC_HAssassin::Shoot ( void )
{
	Vector vForward, vRight, vUp;
	Vector vecShootOrigin;
	QAngle vAngles;

	if ( GetEnemy() == NULL)
	{
		return;
	}

	GetAttachment( "guntip", vecShootOrigin, vAngles );
	
	Vector vecShootDir = GetShootEnemyDir( vecShootOrigin );

	if (m_flLastShot + 2 < gpGlobals->curtime)
	{
		m_flDiviation = 0.10;
	}
	else
	{
		m_flDiviation -= 0.01;
		if (m_flDiviation < 0.02)
			m_flDiviation = 0.02;
	}
	m_flLastShot = gpGlobals->curtime;

	AngleVectors( GetAbsAngles(), &vForward, &vRight, &vUp );

	Vector	vecShellVelocity = vRight * random->RandomFloat(40,90) + vUp * random->RandomFloat(75,200) + vForward * random->RandomFloat(-40, 40);
	EjectShell( GetAbsOrigin() + vUp * 32 + vForward * 12, vecShellVelocity, GetAbsAngles().y, 0 ); 
	FireBullets( 1, vecShootOrigin, vecShootDir, Vector( m_flDiviation, m_flDiviation, m_flDiviation ), 2048, m_iAmmoType ); // shoot +-8 degrees

	//NDebugOverlay::Line( vecShootOrigin, vecShootOrigin + vecShootDir * 2048, 255, 0, 0, true, 2.0 );

	CPASAttenuationFilter filter( this );
	EmitSound( filter, entindex(), "HAssassin.Shot" );

	DoMuzzleFlash();

	VectorAngles( vecShootDir, vAngles );
	SetPoseParameter( "shoot", vecShootDir.x );

	m_cAmmoLoaded--;
}
开发者ID:AgentAgrimar,项目名称:source-sdk-trilogy,代码行数:48,代码来源:hl1_npc_hassassin.cpp


示例19: Shoot

//=========================================================
// Shoot
//=========================================================
void CHAssassin :: Shoot ( void )
{
	if (m_hEnemy == NULL)
	{
		return;
	}

	Vector vecShootOrigin = GetGunPosition();
	Vector vecShootDir = ShootAtEnemy( vecShootOrigin );

	if (m_flLastShot + 2 < gpGlobals->time)
	{
		m_flDiviation = 0.10;
	}
	else
	{
		m_flDiviation -= 0.01;
		if (m_flDiviation < 0.02)
			m_flDiviation = 0.02;
	}
	m_flLastShot = gpGlobals->time;

	UTIL_MakeVectors ( pev->angles );

	Vector	vecShellVelocity = gpGlobals->v_right * RANDOM_FLOAT(40,90) + gpGlobals->v_up * RANDOM_FLOAT(75,200) + gpGlobals->v_forward * RANDOM_FLOAT(-40, 40);
	EjectBrass ( pev->origin + gpGlobals->v_up * 32 + gpGlobals->v_forward * 12, vecShellVelocity, pev->angles.y, m_iShell, TE_BOUNCE_SHELL); 
	FireBullets(1, vecShootOrigin, vecShootDir, Vector( m_flDiviation, m_flDiviation, m_flDiviation ), 2048, BULLET_MONSTER_9MM ); // shoot +-8 degrees

	switch(RANDOM_LONG(0,1))
	{
	case 0:
		EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/pl_gun1.wav", RANDOM_FLOAT(0.6, 0.8), ATTN_NORM);
		break;
	case 1:
		EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/pl_gun2.wav", RANDOM_FLOAT(0.6, 0.8), ATTN_NORM);
		break;
	}

	pev->effects |= EF_MUZZLEFLASH;

	Vector angDir = UTIL_VecToAngles( vecShootDir );
	SetBlending( 0, angDir.x );

	m_cAmmoLoaded--;
}
开发者ID:6779660,项目名称:halflife,代码行数:48,代码来源:hassassin.cpp


示例20: W_FireSuperShotgun

/*
================
W_FireSuperShotgun
================
*/
void W_FireSuperShotgun()
{
	vec3_t          dir;

	if ( self->s.v.currentammo == 1 )
	{
		W_FireShotgun();
		return;
	}
	sound( self, CHAN_WEAPON, "weapons/shotgn2.wav", 1, ATTN_NORM );
	g_globalvars.msg_entity = EDICT_TO_PROG( self );

	trap_WriteByte( MSG_ONE, SVC_BIGKICK );

	if ( deathmatch != 4 )
		self->s.v.currentammo = self->s.v.ammo_shells = self->s.v.ammo_shells - 2;
	//dir = aim (self, 100000);
	aim( dir );
	FireBullets( 14, dir, 0.14, 0.08, 0 );
}
开发者ID:stayoutEE,项目名称:qwprogs-qvm,代码行数:25,代码来源:weapons.c



注:本文中的FireBullets函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FireEvent函数代码示例发布时间:2022-05-30
下一篇:
C++ Fire函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap