本文整理汇总了C++中CSprite::SetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CSprite::SetColor方法的具体用法?C++ CSprite::SetColor怎么用?C++ CSprite::SetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSprite
的用法示例。
在下文中一共展示了CSprite::SetColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例2: 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++;
}
}
}
示例3: 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);
//.........这里部分代码省略.........