当前位置: 首页>>代码示例>>C++>>正文


C++ CSprite::SetAttachment方法代码示例

本文整理汇总了C++中CSprite::SetAttachment方法的典型用法代码示例。如果您正苦于以下问题:C++ CSprite::SetAttachment方法的具体用法?C++ CSprite::SetAttachment怎么用?C++ CSprite::SetAttachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSprite的用法示例。


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

示例1: Spawn

// UNDONE: right now this is pretty much a copy of the squid spit with minor changes to the way it does damage
void CBMortar:: Spawn( void )
{
	SetMoveType( MOVETYPE_FLYGRAVITY );
	SetClassname( "bmortar" );
	
	SetSolid( SOLID_BBOX );

	pSprite = CSprite::SpriteCreate( "sprites/mommaspit.vmt", GetAbsOrigin(), true ); 

	if ( pSprite )
	{
		pSprite->SetAttachment( this, 0 );
		pSprite->m_flSpriteFramerate = 5;

		pSprite->m_nRenderMode = kRenderTransAlpha;
		pSprite->SetBrightness( 255 );

		m_iFrame = 0;

		pSprite->SetScale( 2.5f );
	}

	UTIL_SetSize( this, Vector( 0, 0, 0), Vector(0, 0, 0) );

	m_maxFrame = (float)modelinfo->GetModelFrameCount( GetModel() ) - 1;
	m_flDmgTime = gpGlobals->curtime + 0.4;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:28,代码来源:hl1_npc_bigmomma.cpp

示例2: Spawn

//=========================================================
// Spawn
//=========================================================
void CGargantua :: Spawn()
{
	Precache( );

	if (pev->model)
		SET_MODEL(ENT(pev), STRING(pev->model)); //LRC
	else
		SET_MODEL(ENT(pev), "models/garg.mdl");
	UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) );

	pev->solid			= SOLID_SLIDEBOX;
	pev->movetype		= MOVETYPE_STEP;
	m_bloodColor		= BLOOD_COLOR_GREEN;
	if (!pev->health) pev->health	= gSkillData.gargantuaHealth;
	//pev->view_ofs		= Vector ( 0, 0, 96 );// taken from mdl file
	m_flFieldOfView		= -0.2;// width of forward view cone ( as a dotproduct result )
	m_MonsterState		= MONSTERSTATE_NONE;

	MonsterInit();

	m_pEyeGlow = CSprite::SpriteCreate( GARG_EYE_SPRITE_NAME, GetAbsOrigin(), FALSE );
	m_pEyeGlow->SetTransparency( kRenderGlow, 255, 255, 255, 0, kRenderFxNoDissipation );
	m_pEyeGlow->SetAttachment( edict(), 1 );
	EyeOff();
	m_seeTime = gpGlobals->time + 5;
	m_flameTime = gpGlobals->time + 2;
}
开发者ID:XashDev,项目名称:XashXT,代码行数:30,代码来源:gargantua.cpp

示例3: Spawn

void CNPC_ControllerHeadBall::Spawn( void )
{
	Precache( );
	// motor
	SetMoveType( MOVETYPE_FLY );
	SetSolid( SOLID_BBOX );
	SetSize( vec3_origin, vec3_origin );

	m_pSprite = CSprite::SpriteCreate( "sprites/xspark4.vmt", GetAbsOrigin(), FALSE );
	m_pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
	m_pSprite->SetAttachment( this, 0 );
	m_pSprite->SetScale( 2.0 );

	UTIL_SetSize( this, Vector( 0, 0, 0), Vector(0, 0, 0) );
	UTIL_SetOrigin( this, GetAbsOrigin() );

	SetThink( &CNPC_ControllerHeadBall::HuntThink );
	SetTouch( &CNPC_ControllerHeadBall::BounceTouch );

//	m_vecIdeal = vec3_origin;	//(0,0,0)

	SetNextThink( gpGlobals->curtime + 0.1 );

	m_hOwner = GetOwnerEntity();

	m_flSpawnTime = gpGlobals->curtime;
}
开发者ID:AgentAgrimar,项目名称:source-sdk-trilogy,代码行数:27,代码来源:hl1_npc_controller.cpp

示例4: Shoot

void CSquidSpit::Shoot( CBaseEntity *pOwner, Vector vecStart, Vector vecVelocity )
{
	CSquidSpit *pSpit = CREATE_ENTITY( CSquidSpit, "squidspit" );
	pSpit->Spawn();
	
	UTIL_SetOrigin( pSpit, vecStart );
	pSpit->SetAbsVelocity( vecVelocity );
	pSpit->SetOwnerEntity( pOwner );

	CSprite *pSprite = (CSprite*)pSpit->GetSprite();

	if ( pSprite )
	{
		pSprite->SetAttachment( pSpit, 0 );
		pSprite->SetOwnerEntity( pSpit );

		pSprite->SetScale( 0.5 );
		pSprite->SetTransparency( pSpit->m_nRenderMode, pSpit->m_clrRender->r, pSpit->m_clrRender->g, pSpit->m_clrRender->b, pSpit->m_clrRender->a, pSpit->m_nRenderFX );
	}


	CPVSFilter filter( vecStart );

	VectorNormalize( vecVelocity );
	te->SpriteSpray( filter, 0.0, &vecStart , &vecVelocity, pSpit->m_nSquidSpitSprite, 210, 25, 15 );
}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:26,代码来源:hl1_npc_bullsquid.cpp

示例5: DoLoadEffect

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponCrossbow::DoLoadEffect( void )
{
	SetSkin( BOLT_SKIN_GLOW );

	CBasePlayer *pOwner = ToBasePlayer( GetOwner() );

	if ( pOwner == NULL )
		return;

	CBaseViewModel *pViewModel = pOwner->GetViewModel();

	if ( pViewModel == NULL )
		return;

	CEffectData	data;

	data.m_nEntIndex = pViewModel->entindex();
	data.m_nAttachmentIndex = 1;

	DispatchEffect( "CrossbowLoad", data );

	CSprite *pBlast = CSprite::SpriteCreate( CROSSBOW_GLOW_SPRITE2, GetAbsOrigin(), false );

	if ( pBlast )
	{
		pBlast->SetAttachment( pOwner->GetViewModel(), 1 );
		pBlast->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNone );
		pBlast->SetBrightness( 128 );
		pBlast->SetScale( 0.2f );
		pBlast->FadeOutFromSpawn();
	}
}
开发者ID:SCell555,项目名称:source-sdk-2013,代码行数:35,代码来源:weapon_crossbow.cpp

示例6: Spawn

//-----------------------------------------------------------------------------
// Purpose: Spawn the entity
//-----------------------------------------------------------------------------
void CNPC_CeilingTurret::Spawn( void )
{ 
	Precache();

	SetModel( CEILING_TURRET_MODEL );
	
	BaseClass::Spawn();

	m_HackedGunPos	= Vector( 0, 0, 12.75 );
	SetViewOffset( EyeOffset( ACT_IDLE ) );
	m_flFieldOfView	= 0.0f;
	m_takedamage	= DAMAGE_YES;
	m_iHealth		= 1000;
	m_bloodColor	= BLOOD_COLOR_MECH;
	
	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_NOT_STANDABLE );

	SetHeight( CEILING_TURRET_RETRACT_HEIGHT );

	AddFlag( FL_AIMTARGET );
	AddEFlags( EFL_NO_DISSOLVE );

	SetPoseParameter( m_poseAim_Yaw, 0 );
	SetPoseParameter( m_poseAim_Pitch, 0 );

	m_iAmmoType = GetAmmoDef()->Index( "AR2" );

	//Create our eye sprite
	m_pEyeGlow = CSprite::SpriteCreate( CEILING_TURRET_GLOW_SPRITE, GetLocalOrigin(), false );
	m_pEyeGlow->SetTransparency( kRenderTransAdd, 255, 0, 0, 128, kRenderFxNoDissipation );
	m_pEyeGlow->SetAttachment( this, 2 );

	//Set our autostart state
	m_bAutoStart = !!( m_spawnflags & SF_CEILING_TURRET_AUTOACTIVATE );
	m_bEnabled	 = ( ( m_spawnflags & SF_CEILING_TURRET_STARTINACTIVE ) == false );

	//Do we start active?
	if ( m_bAutoStart && m_bEnabled )
	{
		SetThink( &CNPC_CeilingTurret::AutoSearchThink );
		SetEyeState( TURRET_EYE_DORMANT );
	}
	else
	{
		SetEyeState( TURRET_EYE_DISABLED );
	}

	//Stagger our starting times
	SetNextThink( gpGlobals->curtime + random->RandomFloat( 0.1f, 0.3f ) );

	// Don't allow us to skip animation setup because our attachments are critical to us!
	SetBoneCacheFlags( BCF_NO_ANIMATION_SKIP );
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:57,代码来源:npc_turret_ceiling.cpp

示例7: DoLoadEffect

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponCrossbow::DoLoadEffect()
{
	SetSkin(BOLT_SKIN_GLOW);

	CBasePlayer *pOwner = ToBasePlayer( GetOwner() );

	if ( !pOwner )
		return;

	CEffectData	data;
	data.m_nAttachmentIndex = 1;

#ifdef GAME_DLL

	data.m_nEntIndex = entindex();

	CPASFilter filter(data.m_vOrigin);
	filter.RemoveRecipient(pOwner);
	te->DispatchEffect(filter, 0.0, data.m_vOrigin, "CrossbowLoad", data);

#else

	CBaseViewModel *pViewModel = pOwner->GetViewModel();

	if ( pViewModel != NULL )
	{
		if ( ::input->CAM_IsThirdPerson() )
			data.m_hEntity = pViewModel->GetRefEHandle();
		else
			data.m_hEntity = GetRefEHandle();

		DispatchEffect("CrossbowLoad", data);
	}

#endif

	//Tony; switched this up, always attach it to the weapon, not the view model!!
#ifndef CLIENT_DLL
	CSprite *pBlast = CSprite::SpriteCreate( CROSSBOW_GLOW_SPRITE2, GetAbsOrigin(), false );

	if ( pBlast )
	{
		pBlast->SetAttachment(this, 1);
		pBlast->SetTransparency(kRenderTransAdd, 255, 255, 255, 255, kRenderFxNone );
		pBlast->SetBrightness(128);
		pBlast->SetScale(0.2f);
		pBlast->FadeOutFromSpawn();
	}
#endif
}
开发者ID:InfoSmart,项目名称:InSource-Singleplayer,代码行数:53,代码来源:weapon_crossbow.cpp

示例8: Spawn

void CXenPLight :: Spawn( void )
{
	Precache();

	SET_MODEL( ENT(pev), "models/light.mdl" );
	pev->movetype	= MOVETYPE_NONE;
	pev->solid		= SOLID_TRIGGER;

	UTIL_SetSize( pev, Vector(-80,-80,0), Vector(80,80,32));
	SetActivity( ACT_IDLE );
	pev->nextthink = gpGlobals->time + 0.1;
	pev->frame = RANDOM_FLOAT(0,255);

	m_pGlow = CSprite::SpriteCreate( XEN_PLANT_GLOW_SPRITE, pev->origin + Vector((float)0, (float)0, (float)((pev->mins.z+pev->maxs.z)*0.5)), FALSE );
	m_pGlow->SetTransparency( kRenderGlow, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, pev->renderamt, pev->renderfx );
	m_pGlow->SetAttachment( edict(), 1 );
}
开发者ID:Arkshine,项目名称:NS,代码行数:17,代码来源:xen.cpp

示例9: DoLoadEffect

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponCrossbow::DoLoadEffect( void )
{
	SetSkin( BOLT_SKIN_GLOW );

	CBasePlayer *pOwner = ToBasePlayer( GetOwner() );

	if ( pOwner == NULL )
		return;

	//Tony; change this up a bit; on the server, dispatch an effect but don't send it to the client who fires
	//on the client, create an effect either in the view model, or on the world model if first person.
	CEffectData	data;

	data.m_nAttachmentIndex = 1;
	data.m_vOrigin = pOwner->GetAbsOrigin();

	CPASFilter filter( data.m_vOrigin );

#ifdef GAME_DLL
	filter.RemoveRecipient( pOwner );
	data.m_nEntIndex = entindex();
#else
	CBaseViewModel *pViewModel = pOwner->GetViewModel();
	if ( ShouldDrawUsingViewModel() && pViewModel != NULL )
		data.m_hEntity = pViewModel->GetRefEHandle();
	else
		data.m_hEntity = GetRefEHandle();
#endif

	DispatchEffect( "CrossbowLoad", data, filter );

#ifndef CLIENT_DLL
	CSprite *pBlast = CSprite::SpriteCreate( CROSSBOW_GLOW_SPRITE2, GetAbsOrigin(), false );

	if ( pBlast )
	{
		pBlast->SetAttachment( this, 1 );
		pBlast->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNone );
		pBlast->SetBrightness( 128 );
		pBlast->SetScale( 0.2f );
		pBlast->FadeOutFromSpawn();
	}
#endif
	
}
开发者ID:hlstriker,项目名称:source-sdk-2013,代码行数:48,代码来源:weapon_crossbow.cpp

示例10: Spawn

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CShieldGrenade::Spawn( void )
{
	BaseClass::Spawn();
	m_LastCollision.Init( 0, 0, 0 );
	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
	SetSolid( SOLID_BBOX );
	SetGravity( 1.0 );
	SetFriction( 0.9 );
	SetModel( "models/weapons/w_grenade.mdl");
	UTIL_SetSize(this, Vector( -4, -4, -4), Vector(4, 4, 4));
	m_IsEMPed = false;
	m_IsDeployed = false;

	m_flEMPDamageEndTime = 0.0f;

	SetTouch( StickyTouch );
	SetCollisionGroup( TFCOLLISION_GROUP_GRENADE );

	// Create a green light
	m_pLiveSprite = CSprite::SpriteCreate( "sprites/redglow1.vmt", GetLocalOrigin() + Vector(0,0,1), false );
	m_pLiveSprite->SetTransparency( kRenderGlow, 0, 0, 255, 128, kRenderFxNoDissipation );
	m_pLiveSprite->SetScale( 1 );
	m_pLiveSprite->SetAttachment( this, 0 );
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:27,代码来源:tf_shieldgrenade.cpp

示例11: NextActivity

void CNihilanth :: NextActivity( )
{
	UTIL_MakeAimVectors( pev->angles );

	if (m_irritation >= 2)
	{
		if (m_pBall == NULL)
		{
			m_pBall = CSprite::SpriteCreate( "sprites/tele1.spr", pev->origin, TRUE );
			if (m_pBall)
			{
				m_pBall->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
				m_pBall->SetAttachment( edict(), 1 );
				m_pBall->SetScale( 4.0 );
				m_pBall->pev->framerate = 10.0;
				m_pBall->TurnOn( );
			}
		}

		if (m_pBall)
		{
			MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
				WRITE_BYTE( TE_ELIGHT );
				WRITE_SHORT( entindex( ) + 0x1000 );		// entity, attachment
				WRITE_COORD( pev->origin.x );		// origin
				WRITE_COORD( pev->origin.y );
				WRITE_COORD( pev->origin.z );
				WRITE_COORD( 256 );	// radius
				WRITE_BYTE( 255 );	// R
				WRITE_BYTE( 192 );	// G
				WRITE_BYTE( 64 );	// B
				WRITE_BYTE( 200 );	// life * 10
				WRITE_COORD( 0 ); // decay
			MESSAGE_END();
		}
	}

	if ((pev->health < gSkillData.nihilanthHealth / 2 || m_iActiveSpheres < N_SPHERES / 2) && m_hRecharger == NULL && m_iLevel <= 9)
	{
		char szName[64];

		CBaseEntity *pEnt = NULL;
		CBaseEntity *pRecharger = NULL;
		float flDist = 8192;

		sprintf(szName, "%s%d", m_szRechargerTarget, m_iLevel );

		while ((pEnt = UTIL_FindEntityByTargetname( pEnt, szName )) != NULL)
		{
			float flLocal = (pEnt->pev->origin - pev->origin).Length();
			if (flLocal < flDist)
			{
				flDist = flLocal;
				pRecharger = pEnt;
			}	
		}
		
		if (pRecharger)
		{
			m_hRecharger = pRecharger;
			m_posDesired = Vector( pev->origin.x, pev->origin.y, pRecharger->pev->origin.z );
			m_vecDesired = (pRecharger->pev->origin - m_posDesired).Normalize( );
			m_vecDesired.z = 0;
			m_vecDesired = m_vecDesired.Normalize();
		}
		else
		{
			m_hRecharger = NULL;
			ALERT( at_aiconsole, "nihilanth can't find %s\n", szName );
			m_iLevel++;
			if (m_iLevel > 9)
				m_irritation = 2;
		}
	}

	float flDist = (m_posDesired - pev->origin).Length();
	float flDot = DotProduct( m_vecDesired, gpGlobals->v_forward );

	if (m_hRecharger != NULL)
	{
		// at we at power up yet?
		if (flDist < 128.0)
		{
			int iseq = LookupSequence( "recharge" );

			if (iseq != pev->sequence)
			{
				char szText[64];

				sprintf( szText, "%s%d", m_szDrawUse, m_iLevel );
				FireTargets( szText, this, this, USE_ON, 1.0 );

				ALERT( at_console, "fireing %s\n", szText );
			}
			pev->sequence = LookupSequence( "recharge" );
		}
		else
		{
			FloatSequence( );
		}
//.........这里部分代码省略.........
开发者ID:6779660,项目名称:halflife,代码行数:101,代码来源:nihilanth.cpp

示例12: if


//.........这里部分代码省略.........


	// application des dommages

	vecFrontLeft = vecFrontLeft + Vector ( 0, 0, 10 - DIST_TOP );
	vecFrontRight = vecFrontRight + Vector ( 0, 0, 10 - DIST_TOP );
	vecBackRight = vecBackRight + Vector ( 0, 0, 10 - DIST_TOP );
	vecBackLeft = vecBackLeft + Vector ( 0, 0, 10 - DIST_TOP );

	UTIL_TraceLine (vecFrontLeft, vecFrontRight,dont_ignore_monsters, ENT(m_pTankBSP->pev), &tr[0]);
	UTIL_TraceLine (vecFrontRight, vecBackRight,dont_ignore_monsters, ENT(m_pTankBSP->pev), &tr[1]);
	UTIL_TraceLine (vecBackRight, vecBackLeft,	dont_ignore_monsters, ENT(m_pTankBSP->pev), &tr[2]);
	UTIL_TraceLine (vecBackLeft, vecFrontLeft,	dont_ignore_monsters, ENT(m_pTankBSP->pev), &tr[3]);

	CBaseEntity *pEntity = NULL;

	for ( int i = 0 ; i < 4 ; i ++ )
	{
		if ( tr [ i ].pHit != NULL )
		{
			pEntity =  CBaseEntity :: Instance ( tr [ i ].pHit );

			if ( pEntity != NULL && pEntity->pev->takedamage  )
			{
				float fDamage;

				if ( FClassnameIs ( tr[i].pHit, "func_breakable" ) )
				{
					fDamage =  pEntity->pev->health;
				}
				else
				{
					fDamage = pev->velocity.Length() * 1.5 + 20;
				}

				pEntity->TakeDamage ( pev, pev , fDamage , DMG_CRUSH );
			}
		}
	}

	//rectification de la position de la camera

	vecCamAim = UpdateCam();

	if ( m_pCam->pev->origin != vecCamAim )
		m_pCam->pev->velocity = ( vecCamAim - m_pCam->pev->origin ) * 10;

	UpdateCamAngle ( vecCamAim, NEXTTHINK_TIME );



	//tir de la tourelle

	if ( ( m_pPlayer->pev->button & IN_ATTACK ) && ( gpGlobals->time > m_flLastAttack1 + TANK_REFIRE_DELAY ) )
	{
		Fire ( bCanon );
		bCanon = bCanon == TRUE ? FALSE : TRUE;

		EMIT_SOUND(ENT(pev), CHAN_AUTO, TIR_SOUND, 1, ATTN_NORM);
		m_flLastAttack1 = gpGlobals->time;

		m_pCam->pev->avelocity.x -= 45;

	}

	//tir de la mitrailleuse

	if ( m_pPlayer->pev->button & IN_ATTACK2 )
	{
		Vector posGun, dirGun;
		GetAttachment( 3, posGun, Vector ( 0, 0, 0 ) );
		UTIL_MakeVectorsPrivate( TourelleAngle(), dirGun, NULL, NULL );
		FireBullets( 1, posGun, dirGun, VECTOR_CONE_5DEGREES, 8192, BULLET_MONSTER_12MM );

		EMIT_SOUND(ENT(pev), CHAN_WEAPON, MITRAILLEUSE_SOUND, 1, ATTN_NORM);

		if ( !FStrEq(STRING(gpGlobals->mapname), "l3m10") && !FStrEq(STRING(gpGlobals->mapname), "l3m12")  && !FStrEq(STRING(gpGlobals->mapname), "l3m14")  )
		{			
			CSprite *pSprite = CSprite::SpriteCreate( SPRITE_MUZ, posGun, TRUE );
			pSprite->AnimateAndDie( 15 );
			pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
			pSprite->SetAttachment( edict(), 4 );
			pSprite->SetScale( SPRITE_MUZ_SCALE );
		}


	}



	//sond du tank

	UpdateSound ();

	CSoundEnt::InsertSound ( bits_SOUND_DANGER, pev->origin + pev->velocity * 2.5, 150, NEXTTHINK_TIME );
	CSoundEnt::InsertSound ( bits_SOUND_PLAYER, pev->origin, 2000, 0.5 );



}
开发者ID:jlecorre,项目名称:hlinvasion,代码行数:101,代码来源:tank.cpp

示例13: Fire

void CTank :: Fire ( int canon )
{
	Vector vecGun;
	GetAttachment( canon, vecGun, Vector(0,0,0) );

	if ( !FStrEq(STRING(gpGlobals->mapname), "l3m10") && !FStrEq(STRING(gpGlobals->mapname), "l3m12")  && !FStrEq(STRING(gpGlobals->mapname), "l3m14")  )
	{			
		CSprite *pSprite = CSprite::SpriteCreate( SPRITE_SMOKE, vecGun, TRUE );
		pSprite->AnimateAndDie( 15 );
		pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
		pSprite->SetAttachment( edict(), canon+1 );
		pSprite->SetScale( SPRITE_SMOKE_SCALE );
	}


	TraceResult tr;

	UTIL_MakeVectors ( TourelleAngle() );
	UTIL_TraceLine( vecGun, vecGun + gpGlobals->v_forward * 8192, dont_ignore_monsters, edict(), &tr );

	// pas de dommages - la fonction standart donne un rayon 2.5 fois les dommages
	// 250 * 2.5 = 625	- bcp trop grand

	ExplosionCreate( tr.vecEndPos, pev->angles, NULL/*edict()*/, 250, FALSE );

	// on applique nous-même les dommages - rayon : 250
	::RadiusDamage( tr.vecEndPos, pev, pev, 300, 300, CLASS_NONE, DMG_BLAST );
	
	//effet de fumée
	EnvSmokeCreate( tr.vecEndPos, 4, 10, 2, NULL );

/*	// sprites de feu

	for ( int i=0; i<4; i++ )
	{
		for ( int j=0; j<3; j++ )
		{
			CSprite *pSpr = CSprite::SpriteCreate ( SPRITE_FEU, tr.vecEndPos + Vector(0,0,50), TRUE );
			pSpr->SetTransparency ( kRenderTransAdd, 255, 255, 255, 180, kRenderFxNone );

			pSpr->pev->scale		= (float)((float)SPRITE_FEU_SCALE*2*(1/(i+1)));
			pSpr->pev->framerate	= RANDOM_FLOAT(18,24);
			pSpr->pev->velocity		= Vector ( RANDOM_FLOAT(-50,50)*(3-i)/3,RANDOM_FLOAT(-50,50)*(3-i)/3, 50*(i));
			pSpr->pev->spawnflags  |= SF_SPRITE_ONCE;
			pSpr->TurnOn();
		}
	}
*/
/*	for ( i=0; i<1; i++ )
	{
		CSprite *pSpr = CSprite::SpriteCreate ( SPRITE_SMOKEBALL, Vector(pev->origin.x,pev->origin.y,pev->origin.z + 100), TRUE );
		pSpr->SetScale ( SPRITE_SMOKEBALL_SCALE );
		pSpr->AnimateAndDie ( RANDOM_FLOAT(3,4) );
		pSpr->SetTransparency ( kRenderTransAlpha, 255, 255, 255, 200, kRenderFxNone );
		pSpr->pev->velocity = Vector ( RANDOM_FLOAT(-50,50),RANDOM_FLOAT(-50,50),RANDOM_FLOAT(130,150) );
	}
*/
	//breakable spéciaux

	if ( FClassnameIs (tr.pHit, "func_breakable") && VARS(tr.pHit)->spawnflags & SF_BREAK_TANKTOUCH )
	{
		CBreakable *pBreak = (CBreakable*) CBaseEntity::Instance(tr.pHit);

		if ( pBreak->CheckTankPrev() )
		{
			pBreak->pev->health = 0;
			pBreak->Killed( pev, GIB_NORMAL );
			pBreak->Die();
		}
	}
}
开发者ID:jlecorre,项目名称:hlinvasion,代码行数:71,代码来源:tank.cpp

示例14: Spawn

//-----------------------------------------------------------------------------
// Purpose: Spawn the entity
//-----------------------------------------------------------------------------
void CNPC_CombineCamera::Spawn()
{
	Precache();

	SetModel(COMBINE_CAMERA_MODEL);

	m_pEyeFlash = CSprite::SpriteCreate(COMBINE_CAMERA_FLASH_SPRITE, GetLocalOrigin(), FALSE);
	m_pEyeFlash->SetTransparency(kRenderGlow, 255, 255, 255, 0, kRenderFxNoDissipation);
	m_pEyeFlash->SetAttachment(this, 2);
	m_pEyeFlash->SetBrightness(0);
	m_pEyeFlash->SetScale(1.0);

	BaseClass::Spawn();

	m_HackedGunPos	= Vector(0, 0, 12.75);
	SetViewOffset(EyeOffset(ACT_IDLE));
	m_flFieldOfView	= CAMERA_FOV_WIDE;
	m_takedamage	= DAMAGE_YES;
	m_iHealth		= 50;
	m_bloodColor	= BLOOD_COLOR_MECH;
	
	SetSolid(SOLID_BBOX);
	AddSolidFlags(FSOLID_NOT_STANDABLE);

	SetHeight(COMBINE_CAMERA_RETRACT_HEIGHT);

	AddFlag(FL_AIMTARGET);

	SetPoseParameter(COMBINE_CAMERA_BC_YAW, 0);
	SetPoseParameter(COMBINE_CAMERA_BC_PITCH, 0);

	m_iAmmoType = GetAmmoDef()->Index("Pistol");

	// Create our eye sprite
	m_pEyeGlow = CSprite::SpriteCreate(COMBINE_CAMERA_GLOW_SPRITE, GetLocalOrigin(), false);
	m_pEyeGlow->SetTransparency(kRenderWorldGlow, 255, 0, 0, 128, kRenderFxNoDissipation);
	m_pEyeGlow->SetAttachment(this, 2);

	// Set our enabled state
	m_bEnabled = ((m_spawnflags & SF_COMBINE_CAMERA_STARTINACTIVE) == false);

	// Make sure the radii are sane.
	if (m_nOuterRadius <= 0)
	{
		m_nOuterRadius = 300;
	}

	if (m_nInnerRadius <= 0)
	{
		m_nInnerRadius = 450;
	}

	if (m_nOuterRadius < m_nInnerRadius)
	{
		swap(m_nOuterRadius, m_nInnerRadius);
	}

	// Do we start active?
	if (m_bEnabled)
	{
		Deploy();
	}
	else
	{
		SetEyeState(CAMERA_EYE_DISABLED);
	}

	//Adrian: No shadows on these guys.
	AddEffects( EF_NOSHADOW );

	// Stagger our starting times
	SetNextThink( gpGlobals->curtime + random->RandomFloat(0.1f, 0.3f) );

	// Don't allow us to skip animation setup because our attachments are critical to us!
	SetBoneCacheFlags( BCF_NO_ANIMATION_SKIP );
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:79,代码来源:npc_combinecamera.cpp


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