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


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

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


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

示例1:

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pSpriteName - 
//			&origin - 
//			animate - 
// Output : CSprite
//-----------------------------------------------------------------------------
CSprite *CSprite::SpriteCreate( const char *pSpriteName, const Vector &origin, bool animate )
{
	CSprite *pSprite = CREATE_ENTITY( CSprite, "env_sprite" );
	pSprite->SpriteInit( pSpriteName, origin );
	pSprite->SetSolid( SOLID_NONE );
	UTIL_SetSize( pSprite, vec3_origin, vec3_origin );
	pSprite->SetMoveType( MOVETYPE_NONE );
	if ( animate )
		pSprite->TurnOn();

	return pSprite;
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例2: GetClassPtr

CSprite *CSprite::SpriteCreate( const char *pSpriteName, const Vector &origin, BOOL animate )
{
	CSprite *pSprite = GetClassPtr( (CSprite *)NULL );
	pSprite->SpriteInit( pSpriteName, origin );
	pSprite->pev->classname = MAKE_STRING("env_sprite");
	pSprite->pev->solid = SOLID_NOT;
	pSprite->pev->movetype = MOVETYPE_NOCLIP;
	if ( animate )
		pSprite->TurnOn();

	return pSprite;
}
开发者ID:NoFreeWill,项目名称:MultiplayerSource,代码行数:12,代码来源:effects.cpp

示例3: 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

示例4: Spawn

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CNPC_AntlionGrub::Spawn( void )
{
	Precache();

	SetModel( ANTLIONGRUB_MODEL );
	
	m_NPCState				= NPC_STATE_NONE;
	m_iHealth				= sk_antliongrub_health.GetFloat();
	m_iMaxHealth			= m_iHealth;
	m_flFieldOfView			= 0.5f;
	
	SetSolid( SOLID_BBOX );
	SetMoveType( MOVETYPE_NONE );
	SetCollisionGroup( COLLISION_GROUP_DEBRIS );
	SetHullSizeNormal();
	SetHullType( HULL_SMALL_CENTERED );
	SetBloodColor( BLOOD_COLOR_YELLOW );

	CapabilitiesClear();

	m_flNextVoiceChange		= gpGlobals->curtime;
	m_flSquashTime			= gpGlobals->curtime;
	m_flNearTime			= gpGlobals->curtime;
	m_flHealthTime			= gpGlobals->curtime;
	m_flEnemyHostileTime	= gpGlobals->curtime;

	m_bMoving				= false;
	m_bSquashed				= false;
	m_bSquashValid			= false;
	m_bHealing				= false;

	m_nHealthReserve		= 10;
	
	SetTouch( GrubTouch );

	// Attach to the surface under our belly
	AttachToSurface();

	// Use detailed collision because we're an odd shape
	CollisionProp()->SetSurroundingBoundsType( USE_HITBOXES );
	
	/*
	CSoundEnvelopeController &controller = CSoundEnvelopeController::GetController();

	CPASAttenuationFilter filter( this );
	m_pMovementSound	= controller.SoundCreate( filter, entindex(), CHAN_BODY, "NPC_Antlion.Movement", 3.9f );
	m_pVoiceSound		= controller.SoundCreate( filter, entindex(), CHAN_VOICE, "NPC_Antlion.Voice", 3.9f );
	m_pHealSound		= controller.SoundCreate( filter, entindex(), CHAN_STATIC, "NPC_Antlion.Heal", 3.9f );

	controller.Play( m_pMovementSound, 0.0f, 100 );
	controller.Play( m_pVoiceSound, 0.0f, 100 );
	controller.Play( m_pHealSound, 0.0f, 100 );
	*/

	m_pGlowSprite = CSprite::SpriteCreate( "sprites/blueflare1.vmt", GetLocalOrigin(), false );

	Assert( m_pGlowSprite );

	if ( m_pGlowSprite == NULL )
		return;

	Vector vecUp;
	GetVectors( NULL, NULL, &vecUp );

	m_pGlowSprite->TurnOn();
	m_pGlowSprite->SetTransparency( kRenderWorldGlow, 156, 169, 121, 164, kRenderFxNoDissipation );
	m_pGlowSprite->SetAbsOrigin( GetAbsOrigin() + vecUp * 8.0f );
	m_pGlowSprite->SetScale( 1.0f );
	m_pGlowSprite->SetGlowProxySize( 16.0f );

	// We don't want to teleport at this point
	AddSpawnFlags( SF_NPC_FALL_TO_GROUND );

	// We get a bogus error otherwise
	NPCInit();
	AddSolidFlags( FSOLID_TRIGGER );
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:80,代码来源:npc_antliongrub.cpp


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