本文整理汇总了C++中CCharacter::GiveCustomWeapon方法的典型用法代码示例。如果您正苦于以下问题:C++ CCharacter::GiveCustomWeapon方法的具体用法?C++ CCharacter::GiveCustomWeapon怎么用?C++ CCharacter::GiveCustomWeapon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCharacter
的用法示例。
在下文中一共展示了CCharacter::GiveCustomWeapon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Tick
//.........这里部分代码省略.........
break;
case POWERUP_KIT:
if(pChr->AddKit())
{
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_ARMOR);
RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
m_Life = 0;
m_Flashing = false;
}
break;
// todo: clean and remove parent weapon type
case POWERUP_WEAPON:
if(m_Subtype >= 0 && m_Subtype < NUM_CUSTOMWEAPONS)
{
/*
if (Parent < 0 || Parent >= NUM_WEAPONS)
{
RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
m_Life = 0;
m_Flashing = false;
break;
}
*/
float AmmoFill = 1.0f;
if (m_Dropable)
AmmoFill = 0.3f + frandom()*0.3f;
if (m_Ammo >= 0.0f)
AmmoFill = m_Ammo;
if (pChr->GiveCustomWeapon(m_Subtype, AmmoFill))
{
if(m_Subtype == WEAPON_GRENADE)
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_GRENADE);
else
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_SHOTGUN);
if(pChr->GetPlayer())
{
//GameServer()->SendWeaponPickup(pChr->GetPlayer()->GetCID(), Parent);
GameServer()->SendWeaponPickup(pChr->GetPlayer()->GetCID(), m_Subtype);
//char aBuf[256]; str_format(aBuf, sizeof(aBuf), "Picked up %s", aCustomWeapon[m_Subtype].m_Name);
//GameServer()->SendChatTarget(pChr->GetPlayer()->GetCID(), aBuf);
}
RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
m_Life = 0;
m_Flashing = false;
}
else
{
if (pChr->GiveAmmo(&m_Subtype, AmmoFill))
{
if(m_Subtype == WEAPON_GRENADE)
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_GRENADE);
else
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_SHOTGUN);
//char aBuf[256]; str_format(aBuf, sizeof(aBuf), "Picked up ammo for %s", aCustomWeapon[m_Subtype].m_Name);
//GameServer()->SendChatTarget(pChr->GetPlayer()->GetCID(), aBuf);
示例2: Tick
//.........这里部分代码省略.........
else
if (pChr->GetPlayer()->GotAbility(STORE_HEALTH) && pChr->StoreHealth())
{
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_HEALTH);
RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
m_Life = 0;
m_Flashing = false;
}
break;
case POWERUP_ARMOR:
if(pChr->IncreaseArmor(1))
{
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_ARMOR);
RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
m_Life = 0;
m_Flashing = false;
}
break;
case POWERUP_WEAPON:
if(m_Subtype >= 0 && m_Subtype < NUM_CUSTOMWEAPONS)
{
int Parent = aCustomWeapon[m_Subtype].m_ParentWeapon;
if (Parent < 0 || Parent >= NUM_WEAPONS)
{
RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
m_Life = 0;
m_Flashing = false;
break;
}
if (pChr->GiveCustomWeapon(m_Subtype, 0.2f + frandom()*0.3f))
{
if(Parent == WEAPON_GRENADE)
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_GRENADE);
else
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_SHOTGUN);
if(pChr->GetPlayer())
{
//GameServer()->SendWeaponPickup(pChr->GetPlayer()->GetCID(), Parent);
char aBuf[256]; str_format(aBuf, sizeof(aBuf), "Picked up %s", aCustomWeapon[m_Subtype].m_Name);
GameServer()->SendChatTarget(pChr->GetPlayer()->GetCID(), aBuf);
}
RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
m_Life = 0;
m_Flashing = false;
}
else
{
if (pChr->GiveAmmo(&m_Subtype, 0.125f + frandom()*0.15f))
{
char aBuf[256]; str_format(aBuf, sizeof(aBuf), "Picked up ammo for %s", aCustomWeapon[m_Subtype].m_Name);
GameServer()->SendChatTarget(pChr->GetPlayer()->GetCID(), aBuf);
RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
m_Life = 0;
m_Flashing = false;
}
}
/*if(pChr->GiveWeapon(m_Subtype, 10)) // !pChr->m_WeaponPicked &&