本文整理汇总了C++中CBasePlayer::AddXP方法的典型用法代码示例。如果您正苦于以下问题:C++ CBasePlayer::AddXP方法的具体用法?C++ CBasePlayer::AddXP怎么用?C++ CBasePlayer::AddXP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBasePlayer
的用法示例。
在下文中一共展示了CBasePlayer::AddXP方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetHitgroupDamageMultiplier
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
float CNPC_CombineS::GetHitgroupDamageMultiplier( int iHitGroup, const CTakeDamageInfo &info )
{
bool isNohead = false;
switch( iHitGroup )
{
case HITGROUP_HEAD:
int HeadshotRandom = random->RandomInt(0, 4);
if (!(g_Language.GetInt() == LANGUAGE_GERMAN || UTIL_IsLowViolence()) && g_fr_headshotgore.GetBool())
{
if (isNohead == false && HeadshotRandom == 0 && !(info.GetDamageType() & DMG_NEVERGIB) || isNohead == false && (info.GetDamageType() & (DMG_SNIPER | DMG_BUCKSHOT)) && !(info.GetDamageType() & DMG_NEVERGIB))
{
SetModel("models/gibs/combine_soldier_beheaded.mdl");
DispatchParticleEffect("headshotspray", PATTACH_POINT_FOLLOW, this, "bloodspurt", true);
SpawnBlood(GetAbsOrigin(), g_vecAttackDir, BloodColor(), info.GetDamage());
CGib::SpawnSpecificGibs(this, 6, 750, 1500, "models/gibs/pgib_p3.mdl", 6);
CGib::SpawnSpecificGibs(this, 6, 750, 1500, "models/gibs/pgib_p4.mdl", 6);
EmitSound("Gore.Headshot");
m_iHealth = 0;
g_pGameRules->iHeadshotCount += 1;
isNohead = true;
CBasePlayer *pPlayer = UTIL_PlayerByIndex(1);
if (g_fr_economy.GetBool())
{
pPlayer->AddMoney(5);
}
if (!g_fr_classic.GetBool())
{
pPlayer->AddXP(7);
}
}
else
{
// Soldiers take double headshot damage
return 2.0f;
}
}
else
{
// Soldiers take double headshot damage
return 2.0f;
}
}
return BaseClass::GetHitgroupDamageMultiplier( iHitGroup, info );
}
示例2: NPCKilled
void CSingleplayRules::NPCKilled(CBaseEntity *pVictim, const CTakeDamageInfo &info)
{
CBasePlayer *pEntity = UTIL_GetLocalPlayer();
if (pVictim->m_isRareEntity)
{
switch (GetSkillLevel())
{
case SKILL_EASY:
if (g_fr_economy.GetBool())
{
pEntity->AddMoney(3 * sk_money_multiplier1.GetInt());
}
if (!g_fr_classic.GetBool())
{
pEntity->AddXP(5 * sk_exp_multiplier1.GetInt());
}
break;
case SKILL_MEDIUM:
if (g_fr_economy.GetBool())
{
pEntity->AddMoney(3 * sk_money_multiplier2.GetInt());
}
if (!g_fr_classic.GetBool())
{
pEntity->AddXP(5 * sk_exp_multiplier2.GetInt());
}
break;
case SKILL_HARD:
if (g_fr_economy.GetBool())
{
pEntity->AddMoney(3 * sk_money_multiplier3.GetInt());
}
if (!g_fr_classic.GetBool())
{
pEntity->AddXP(5 * sk_exp_multiplier3.GetInt());
}
break;
case SKILL_VERYHARD:
if (g_fr_economy.GetBool())
{
pEntity->AddMoney(3 * sk_money_multiplier4.GetInt());
}
if (!g_fr_classic.GetBool())
{
pEntity->AddXP(5 * sk_exp_multiplier4.GetInt());
}
break;
case SKILL_NIGHTMARE:
if (g_fr_economy.GetBool())
{
pEntity->AddMoney(3 * sk_money_multiplier5.GetInt());
}
if (!g_fr_classic.GetBool())
{
pEntity->AddXP(5 * sk_exp_multiplier5.GetInt());
}
break;
}
}
else
{
switch (GetSkillLevel())
{
case SKILL_EASY:
if (g_fr_economy.GetBool())
{
pEntity->AddMoney(2 * sk_money_multiplier1.GetInt());
}
if (!g_fr_classic.GetBool())
{
pEntity->AddXP(3 * sk_exp_multiplier1.GetInt());
}
break;
case SKILL_MEDIUM:
if (g_fr_economy.GetBool())
{
pEntity->AddMoney(2 * sk_money_multiplier2.GetInt());
}
if (!g_fr_classic.GetBool())
{
pEntity->AddXP(3 * sk_exp_multiplier2.GetInt());
}
break;
case SKILL_HARD:
if (g_fr_economy.GetBool())
{
pEntity->AddMoney(2 * sk_money_multiplier3.GetInt());
}
if (!g_fr_classic.GetBool())
{
pEntity->AddXP(3 * sk_exp_multiplier3.GetInt());
}
break;
//.........这里部分代码省略.........