本文整理汇总了C++中CASW_Player::AwardAchievement方法的典型用法代码示例。如果您正苦于以下问题:C++ CASW_Player::AwardAchievement方法的具体用法?C++ CASW_Player::AwardAchievement怎么用?C++ CASW_Player::AwardAchievement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CASW_Player
的用法示例。
在下文中一共展示了CASW_Player::AwardAchievement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetHackProgress
void CASW_Button_Area::SetHackProgress(float f, CASW_Marine *pMarine)
{
CBaseEntity *pActor = pMarine;
if ( !pActor )
{
pActor = this;
}
if (m_fHackProgress <= 0 && f > 0 && m_fStartedHackTime == 0)
{
m_fStartedHackTime = gpGlobals->curtime;
}
if (m_fHackProgress < 0.25f && f >= 0.25f)
{
m_OnButtonHackAt25Percent.FireOutput(pActor, this);
}
if (m_fHackProgress < 0.5f && f >= 0.5f)
{
m_OnButtonHackAt50Percent.FireOutput(pActor, this);
pMarine->GetMarineSpeech()->Chatter(CHATTER_HACK_HALFWAY);
}
if (m_fHackProgress < 0.75f && f >= 0.75f)
{
m_OnButtonHackAt75Percent.FireOutput(pActor, this);
}
if (m_fHackProgress < 1.0f && f >= 1.0f)
{
if ( asw_simple_hacking.GetBool() )
{
pMarine->StopUsing();
}
float time_taken = gpGlobals->curtime - m_fStartedHackTime;
// decide if this was a fast hack or not
float fSpeedScale = 1.0f;
if (pMarine)
fSpeedScale *= MarineSkills()->GetSkillBasedValueByMarine(pMarine, ASW_MARINE_SKILL_HACKING, ASW_MARINE_SUBSKILL_HACKING_SPEED_SCALE);
float ideal_time = UTIL_ASW_CalcFastDoorHackTime(m_iWireRows, m_iWireColumns, m_iNumWires, m_iHackLevel, fSpeedScale);
bool bFastHack = time_taken <= ideal_time;
if (asw_debug_medals.GetBool())
{
Msg("Finished door hack, fast = %d.\n", bFastHack);
Msg(" ideal time is %f you took %f\n", ideal_time, time_taken);
}
if (bFastHack && pMarine && pMarine->GetMarineResource())
{
pMarine->GetMarineResource()->m_iFastDoorHacks++;
if ( pMarine->IsInhabited() && pMarine->GetCommander() )
{
pMarine->GetCommander()->AwardAchievement( ACHIEVEMENT_ASW_FAST_WIRE_HACKS );
}
}
if ( GetCurrentHack() )
{
GetCurrentHack()->OnHackComplete();
}
if ( pMarine->GetMarineResource() && pMarine->GetMarineResource()->m_iDamageTakenDuringHack <= 0 )
{
int nAliensKilled = ASWGameResource() ? ASWGameResource()->GetAliensKilledInThisMission() : 0;
if ( ( nAliensKilled - m_iAliensKilledBeforeHack ) > 10 )
{
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CASW_Player *pPlayer = dynamic_cast<CASW_Player*>( UTIL_PlayerByIndex( i ) );
if ( !pPlayer || !pPlayer->IsConnected() || !pPlayer->GetMarine() || pPlayer->GetMarine() == pMarine )
continue;
if ( pPlayer->GetMarine()->GetMarineResource() )
{
pPlayer->GetMarine()->GetMarineResource()->m_bProtectedTech = true;
}
pPlayer->AwardAchievement( ACHIEVEMENT_ASW_PROTECT_TECH );
}
}
}
// unlock it
m_OnButtonHackCompleted.FireOutput(pActor, this);
m_bIsLocked = false;
UpdateWaitingForInput();
UpdatePanelSkin();
EmitSound("ASWComputer.HackComplete");
if ( pMarine && bFastHack )
{
pMarine->GetMarineSpeech()->QueueChatter(CHATTER_HACK_BUTTON_FINISHED, gpGlobals->curtime + 2.0f, gpGlobals->curtime + 3.0f);
}
// if set to use on unlock, then do so
if ( m_bUseAfterHack && pMarine )
{
ActivateUnlockedButton(pMarine);
}
if ( pMarine && !pMarine->IsInhabited() )
{
//.........这里部分代码省略.........