本文整理汇总了C++中IFireMode::GetClipSize方法的典型用法代码示例。如果您正苦于以下问题:C++ IFireMode::GetClipSize方法的具体用法?C++ IFireMode::GetClipSize怎么用?C++ IFireMode::GetClipSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFireMode
的用法示例。
在下文中一共展示了IFireMode::GetClipSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestClipAmmoCountIsValid
void CWeapon::TestClipAmmoCountIsValid()
{
TFireModeVector::iterator itEnd = m_firemodes.end();
for (TFireModeVector::iterator it = m_firemodes.begin(); it != itEnd; ++it)
{
IFireMode* pFM = *it;
if (pFM && pFM->IsEnabled())
{
IEntityClass* pAmmoType = pFM->GetAmmoType();
if(pAmmoType)
{
int clipSize = pFM->GetClipSize();
const SFireModeParams* pFireModeParams = ((CFireMode*)pFM)->GetShared();
if (pFireModeParams)
{
clipSize += pFireModeParams->fireparams.bullet_chamber;
}
const int ammoCount = GetAmmoCount(pAmmoType);
if (ammoCount > clipSize)
{
SetAmmoCount(pAmmoType, clipSize);
const int excessAmmo = ammoCount - clipSize;
SetInventoryAmmoCount(pAmmoType, GetInventoryAmmoCount(pAmmoType) + excessAmmo);
}
}
}
}
}
示例2: GetClipSize
//------------------------------------------------------------------------
int CScriptBind_Weapon::GetClipSize(IFunctionHandler *pH)
{
CWeapon *pWeapon = GetWeapon(pH);
if (!pWeapon)
return pH->EndFunction();
IFireMode* pFireMode = GetRequestedFireMode(pWeapon, pH);
if (pFireMode)
return pH->EndFunction(pFireMode->GetClipSize());
return pH->EndFunction();
}
示例3: ProcessEvent
void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
switch (event)
{
case (eFE_Activate):
{
if (!IsPortActive(pActInfo, 0))
return;
IItemSystem* pItemSys = CCryAction::GetCryAction()->GetIItemSystem();
// get actor
IActor* pActor = CCryAction::GetCryAction()->GetClientActor();
if (!pActor)
return;
IInventory *pInventory = pActor->GetInventory();
if (!pInventory)
return;
IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(GetPortString(pActInfo,1));
IItem* pItem = pItemSys->GetItem(pInventory->GetItemByClass(pClass));
if (!pItem || !pItem->GetIWeapon())
{
pItem = pActor->GetCurrentItem();
if (!pItem || pItem->GetEntity()->GetClass() != pClass || !pItem->GetIWeapon())
{
GameWarning("[flow] CFlowNode_WeaponAmmo: No item/weapon %s!", GetPortString(pActInfo,1).c_str());
return;
}
}
IWeapon *pWeapon = pItem->GetIWeapon();
const string& ammoType = GetPortString(pActInfo,2);
IEntityClass* pAmmoClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(ammoType.c_str());
CRY_ASSERT(pAmmoClass);
IFireMode* pCurrentFireMode = pWeapon->GetFireMode(pWeapon->GetCurrentFireMode());
if (pCurrentFireMode)
{
int clipSize = pCurrentFireMode->GetClipSize();
int ammo = pWeapon->GetAmmoCount(pAmmoClass) + GetPortInt(pActInfo,3);
ammo = CLAMP(ammo, 0, clipSize);
pWeapon->SetAmmoCount(pAmmoClass, ammo);
}
ActivateOutput(pActInfo, 0, pWeapon->GetAmmoCount(pAmmoClass));
}
break;
}
}
示例4: OnStartReload
//------------------------------------------------------------------------
void CWeapon::OnStartReload(EntityId shooterId, IEntityClass* pAmmoType)
{
BROADCAST_WEAPON_EVENT(OnStartReload, (this, shooterId, pAmmoType));
if (CActor *pActor = GetOwnerActor())
{
if (IAIObject *pAIObject=pActor->GetEntity()->GetAI())
if (gEnv->pAISystem)
gEnv->pAISystem->SendSignal( SIGNALFILTER_SENDER, 1, "OnReload", pAIObject);
if(pActor->IsClient())
{
if (gEnv->bMultiplayer && pActor->IsCloaked())
{
CPersistantStats::GetInstance()->IncrementClientStats(EIPS_CloakedReloads);
}
if(m_weaponsharedparams->bulletBeltParams.numBullets > 0)
{
const uint32 refillTime = (uint32)(GetCurrentAnimationTime(eIGS_Owner) * m_weaponsharedparams->bulletBeltParams.beltRefillReloadFraction);
GetScheduler()->TimerAction(refillTime, CSchedulerAction<RefillBeltAction>::Create(RefillBeltAction(this)), false);
}
}
}
IFireMode *pFireMode = GetFireMode(GetCurrentFireMode());
if (pFireMode)
{
if(GetInventoryAmmoCount(pAmmoType) < pFireMode->GetClipSize())
{
BATTLECHATTER(BC_LowAmmo, shooterId);
}
else
{
BATTLECHATTER(BC_Reloading, shooterId);
}
}
}
示例5: ReplenishAmmo
void ReplenishAmmo( IWeapon* pWeapon )
{
IFireMode *pFireMode = pWeapon->GetFireMode(pWeapon->GetCurrentFireMode());
if (pFireMode)
pWeapon->SetAmmoCount(pFireMode->GetAmmoType(), pFireMode->GetClipSize());
}