コード例 #1
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CHudBonusProgress::Reset()
{
	m_iBonusProgress = INIT_BONUS_PROGRESS;

	C_BasePlayer *local = C_BasePlayer::GetLocalPlayer();
	if ( local )
		m_iLastChallenge = local->GetBonusChallenge();

	SetChallengeLabel();

	SetDisplayValue(m_iBonusProgress);
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CHudBonusProgress::OnThink()
{
	C_GameRules *pGameRules = GameRules();

	if ( !pGameRules )
	{
		// Not ready to init!
		return;
	}

	int newBonusProgress = 0;
	int iBonusChallenge = 0;

	C_BasePlayer *local = C_BasePlayer::GetLocalPlayer();
	if ( !local )
	{
		// Not ready to init!
		return;
	}

	// Never below zero
	newBonusProgress = MAX( local->GetBonusProgress(), 0 );
	iBonusChallenge = local->GetBonusChallenge();

	// Only update the fade if we've changed bonusProgress
	if ( newBonusProgress == m_iBonusProgress && m_iLastChallenge == iBonusChallenge )
	{
		return;
	}

	m_iBonusProgress = newBonusProgress;

	if ( m_iLastChallenge != iBonusChallenge )
	{
		m_iLastChallenge = iBonusChallenge;
		SetChallengeLabel();
	}

	g_pClientMode->GetViewportAnimationController()->StartAnimationSequence("BonusProgressFlash");

	if ( pGameRules->IsBonusChallengeTimeBased() )
	{
		SetIsTime( true );
		SetIndent( false );
	}
	else
	{
		SetIsTime( false );
		SetIndent( true );
	}

	SetDisplayValue(m_iBonusProgress);
}