本文整理汇总了C++中CSprite::SetBrightness方法的典型用法代码示例。如果您正苦于以下问题:C++ CSprite::SetBrightness方法的具体用法?C++ CSprite::SetBrightness怎么用?C++ CSprite::SetBrightness使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSprite
的用法示例。
在下文中一共展示了CSprite::SetBrightness方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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();
}
}
示例3: EyeOff
void CBaseTurret::EyeOff( )
{
if (m_pEyeGlow)
{
if (m_eyeBrightness > 0)
{
m_eyeBrightness = max( 0, m_eyeBrightness - 30 );
m_pEyeGlow->SetBrightness( m_eyeBrightness );
}
}
}
示例4: EyeOn
void CBaseTurret::EyeOn( )
{
if (m_pEyeGlow)
{
if (m_eyeBrightness != 255)
{
m_eyeBrightness = 255;
}
m_pEyeGlow->SetBrightness( m_eyeBrightness );
}
}
示例5: 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
}
示例6: SetEyeState
//-----------------------------------------------------------------------------
// Purpose: Sets the state of the glowing eye attached to the turret
// Input : state - state the eye should be in
//-----------------------------------------------------------------------------
void CNPC_CeilingTurret::SetEyeState( eyeState_t state )
{
//Must have a valid eye to affect
if ( m_pEyeGlow == NULL )
return;
//Set the state
switch( state )
{
default:
case TURRET_EYE_SEE_TARGET: //Fade in and scale up
m_pEyeGlow->SetColor( 255, 0, 0 );
m_pEyeGlow->SetBrightness( 164, 0.1f );
m_pEyeGlow->SetScale( 0.4f, 0.1f );
break;
case TURRET_EYE_SEEKING_TARGET: //Ping-pongs
//Toggle our state
m_bBlinkState = !m_bBlinkState;
m_pEyeGlow->SetColor( 255, 128, 0 );
if ( m_bBlinkState )
{
//Fade up and scale up
m_pEyeGlow->SetScale( 0.25f, 0.1f );
m_pEyeGlow->SetBrightness( 164, 0.1f );
}
else
{
//Fade down and scale down
m_pEyeGlow->SetScale( 0.2f, 0.1f );
m_pEyeGlow->SetBrightness( 64, 0.1f );
}
break;
case TURRET_EYE_DORMANT: //Fade out and scale down
m_pEyeGlow->SetColor( 0, 255, 0 );
m_pEyeGlow->SetScale( 0.1f, 0.5f );
m_pEyeGlow->SetBrightness( 64, 0.5f );
break;
case TURRET_EYE_DEAD: //Fade out slowly
m_pEyeGlow->SetColor( 255, 0, 0 );
m_pEyeGlow->SetScale( 0.1f, 3.0f );
m_pEyeGlow->SetBrightness( 0, 3.0f );
break;
case TURRET_EYE_DISABLED:
m_pEyeGlow->SetColor( 0, 255, 0 );
m_pEyeGlow->SetScale( 0.1f, 1.0f );
m_pEyeGlow->SetBrightness( 0, 1.0f );
break;
}
}
示例7: MaintainEye
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CNPC_CombineCamera::MaintainEye()
{
// Angry cameras take a few pictures of their target.
if ((m_bAngry) && (m_nClickCount <= 3))
{
if ((m_flClickTime != 0) && (m_flClickTime < gpGlobals->curtime))
{
m_pEyeFlash->SetScale(1.0);
m_pEyeFlash->SetBrightness(255);
m_pEyeFlash->SetColor(255,255,255);
EmitSound("NPC_CombineCamera.Click");
m_flTurnOffEyeFlashTime = gpGlobals->curtime + 0.1;
m_flClickTime = gpGlobals->curtime + CAMERA_CLICK_INTERVAL;
}
else if ((m_flTurnOffEyeFlashTime != 0) && (m_flTurnOffEyeFlashTime < gpGlobals->curtime))
{
m_flTurnOffEyeFlashTime = 0;
m_pEyeFlash->SetBrightness( 0, 0.25f );
m_nClickCount++;
}
}
}
示例8: 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
}
示例9: SetAngry
//-----------------------------------------------------------------------------
// Purpose: When we become angry, we make an angry sound and start photographing
// whatever target we are tracking.
//-----------------------------------------------------------------------------
void CNPC_CombineCamera::SetAngry(bool bAngry)
{
if ((bAngry) && (!m_bAngry))
{
m_bAngry = true;
m_nClickCount = 0;
m_flClickTime = gpGlobals->curtime + 0.4;
EmitSound("NPC_CombineCamera.Angry");
SetEyeState(CAMERA_EYE_ANGRY);
}
else if ((!bAngry) && (m_bAngry))
{
m_bAngry = false;
// make sure the flash is off (we might be in mid-flash)
m_pEyeFlash->SetBrightness(0);
SetEyeState(GetTarget() ? CAMERA_EYE_SEEKING_TARGET : CAMERA_EYE_IDLE);
}
}
示例10: HuntThink
void CNPC_ControllerHeadBall::HuntThink( void )
{
SetNextThink( gpGlobals->curtime + 0.1 );
if( !m_pSprite )
{
Assert(0);
return;
}
m_pSprite->SetBrightness( m_pSprite->GetBrightness() - 5, 0.1f );
CBroadcastRecipientFilter filter;
te->DynamicLight( filter, 0.0, &GetAbsOrigin(), 255, 255, 255, 0, m_pSprite->GetBrightness() / 16, 0.2, 0 );
// check world boundaries
if (gpGlobals->curtime - m_flSpawnTime > 5 || m_pSprite->GetBrightness() < 64 /*|| GetEnemy() == NULL || m_hOwner == NULL*/ || !IsInWorld() )
{
SetTouch( NULL );
SetThink( &CNPC_ControllerHeadBall::KillThink );
SetNextThink( gpGlobals->curtime );
return;
}
if( !GetEnemy() )
return;
MovetoTarget( GetEnemy()->GetAbsOrigin() );
if ((GetEnemy()->WorldSpaceCenter() - GetAbsOrigin()).Length() < 64)
{
trace_t tr;
UTIL_TraceLine( GetAbsOrigin(), GetEnemy()->WorldSpaceCenter(), MASK_ALL, this, COLLISION_GROUP_NONE, &tr );
CBaseEntity *pEntity = tr.m_pEnt;
if (pEntity != NULL && pEntity->m_takedamage == DAMAGE_YES)
{
ClearMultiDamage( );
Vector dir = GetAbsVelocity();
VectorNormalize( dir );
CTakeDamageInfo info( this, this, sk_controller_dmgball.GetFloat(), DMG_SHOCK );
CalculateMeleeDamageForce( &info, dir, tr.endpos );
pEntity->DispatchTraceAttack( info, dir, &tr );
ApplyMultiDamage();
int haloindex = 0;
int fadelength = 0;
int amplitude = 0;
const Vector vecEnd = tr.endpos;
te->BeamEntPoint( filter, 0.0, entindex(), NULL, 0, &(tr.m_pEnt->GetAbsOrigin()),
g_sModelIndexLaser, haloindex /* no halo */, 0, 10, 3, 20, 20, fadelength,
amplitude, 255, 255, 255, 255, 10 );
}
UTIL_EmitAmbientSound( GetSoundSourceIndex(), GetAbsOrigin(), "Controller.ElectroSound", 0.5, SNDLVL_NORM, 0, 100 );
SetNextAttack( gpGlobals->curtime + 3.0 );
SetThink( &CNPC_ControllerHeadBall::KillThink );
SetNextThink( gpGlobals->curtime + 0.3 );
}
}
示例11: SetEyeState
//-----------------------------------------------------------------------------
// Purpose: Sets the state of the glowing eye attached to the camera
// Input : state - state the eye should be in
//-----------------------------------------------------------------------------
void CNPC_CombineCamera::SetEyeState(eyeState_t state)
{
// Must have a valid eye to affect
if (m_pEyeGlow == NULL)
return;
if (m_bAngry)
{
m_pEyeGlow->SetColor(255, 0, 0);
m_pEyeGlow->SetBrightness(164, 0.1f);
m_pEyeGlow->SetScale(0.4f, 0.1f);
return;
}
// If we're switching to IDLE, and we're still happy, use happy instead
if ( state == CAMERA_EYE_IDLE && m_flEyeHappyTime > gpGlobals->curtime )
{
state = CAMERA_EYE_HAPPY;
}
// Set the state
switch (state)
{
default:
case CAMERA_EYE_IDLE:
{
m_pEyeGlow->SetColor(0, 255, 0);
m_pEyeGlow->SetBrightness(164, 0.1f);
m_pEyeGlow->SetScale(0.4f, 0.1f);
break;
}
case CAMERA_EYE_SEEKING_TARGET:
{
// Toggle our state
m_bBlinkState = !m_bBlinkState;
// Amber
m_pEyeGlow->SetColor(255, 128, 0);
if (m_bBlinkState)
{
// Fade up and scale up
m_pEyeGlow->SetScale(0.25f, 0.1f);
m_pEyeGlow->SetBrightness(164, 0.1f);
}
else
{
// Fade down and scale down
m_pEyeGlow->SetScale(0.2f, 0.1f);
m_pEyeGlow->SetBrightness(64, 0.1f);
}
break;
}
case CAMERA_EYE_FOUND_TARGET:
{
if (!m_bAngry)
{
// Amber
m_pEyeGlow->SetColor(255, 128, 0);
// Fade up and scale up
m_pEyeGlow->SetScale(0.45f, 0.1f);
m_pEyeGlow->SetBrightness(220, 0.1f);
}
else
{
m_pEyeGlow->SetColor(255, 0, 0);
m_pEyeGlow->SetBrightness(164, 0.1f);
m_pEyeGlow->SetScale(0.4f, 0.1f);
}
break;
}
case CAMERA_EYE_DORMANT: // Fade out and scale down
{
m_pEyeGlow->SetColor(0, 255, 0);
m_pEyeGlow->SetScale(0.1f, 0.5f);
m_pEyeGlow->SetBrightness(64, 0.5f);
break;
}
case CAMERA_EYE_DEAD: // Fade out slowly
{
m_pEyeGlow->SetColor(255, 0, 0);
m_pEyeGlow->SetScale(0.1f, 3.0f);
m_pEyeGlow->SetBrightness(0, 3.0f);
break;
}
case CAMERA_EYE_DISABLED:
{
m_pEyeGlow->SetColor(0, 255, 0);
//.........这里部分代码省略.........
示例12: 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 );
}