本文整理汇总了C++中IFireMode::GetProjectileId方法的典型用法代码示例。如果您正苦于以下问题:C++ IFireMode::GetProjectileId方法的具体用法?C++ IFireMode::GetProjectileId怎么用?C++ IFireMode::GetProjectileId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFireMode
的用法示例。
在下文中一共展示了IFireMode::GetProjectileId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetOwnerActor
//------------------------------------------------------------------------
bool CC4::CanSelect() const
{
bool canSelect = (CWeapon::CanSelect() && !OutOfAmmo(false));
//Check for remaining projectiles to detonate
if(!canSelect)
{
CActor *pOwner = GetOwnerActor();
if(!pOwner)
return false;
EntityId detonatorId = pOwner->GetInventory()?pOwner->GetInventory()->GetItemByClass(CItem::sDetonatorClass):0;
//Do not re-select detonator again
if(detonatorId && (detonatorId==pOwner->GetCurrentItemId()))
return false;
IFireMode *pFM = GetFireMode(GetCurrentFireMode());
if(pFM)
{
//CC4::Select will select the detonator in this case
EntityId projectileId = pFM->GetProjectileId();
if(projectileId && g_pGame->GetWeaponSystem()->GetProjectile(projectileId))
return true;
}
}
return canSelect;
};
示例2: StartFire
//------------------------------------------------------------------------
void CDetonate::StartFire()
{
if (CanFire(false))
{
CActor *pOwner=m_pWeapon->GetOwnerActor();
CCCPOINT(DetonateFireMode_StartFireOK);
m_pWeapon->RequireUpdate(eIUS_FireMode);
m_detonationTimer = 0.1f;
m_pWeapon->PlayAction(GetFragmentIds().fire);
m_pWeapon->RequestDetonate();
}
else
{
#if !defined(_RELEASE)
IFireMode* pFM = m_pWeapon->GetFireMode(m_pWeapon->GetCurrentFireMode());
EntityId projectileId = pFM ? pFM->GetProjectileId() : 0;
IEntity * projectile = gEnv->pEntitySystem->GetEntity(projectileId);
CryLog ("[Detonate] Failure to detonate %s '%s' (timer = %.4f, can detonate = %s, fire mode = '%s') projectile = %u (%s '%s')",
m_pWeapon->GetEntity()->GetClass()->GetName(),
m_pWeapon->GetEntity()->GetName(),
m_detonationTimer,
m_canDetonate ? "TRUE" : "FALSE",
pFM ? pFM->GetName() : "NONE",
projectileId,
projectile ? projectile->GetClass()->GetName() : "NONE",
projectile ? projectile->GetName() : "N/A");
#endif
CCCPOINT_IF(m_detonationTimer > 0.0f, DetonateFireMode_CannotFire_TimerNotReachedZero);
CCCPOINT(DetonateFireMode_CannotFire);
}
}
示例3: GetFireMode
//-----------------------------------------------------------------------
bool CC4::OnActionSelectDetonator(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
if(activationMode == eAAM_OnPress)
{
bool projectile = false;
IFireMode* pFM = GetFireMode(GetCurrentFireMode());
if(pFM)
{
EntityId projectileId = pFM->GetProjectileId();
if(projectileId && g_pGame->GetWeaponSystem()->GetProjectile(projectileId))
projectile = true;
}
//If there is some projectile we can switch
if(projectile)
SelectDetonator();
}
return true;
}
示例4: if
//------------------------------------------------------------------------
void CC4::Select(bool select)
{
if(select)
{
bool outOfAmmo = OutOfAmmo(false);
bool projectile = false;
IFireMode *pFM = GetFireMode(GetCurrentFireMode());
if(pFM)
{
EntityId projectileId = pFM->GetProjectileId();
if(projectileId && g_pGame->GetWeaponSystem()->GetProjectile(projectileId))
projectile = true;
}
if(outOfAmmo && projectile)
{
SelectDetonator();
return;
}
else if(outOfAmmo)
{
Select(false);
CActor *pOwner=GetOwnerActor();
if(!pOwner)
return;
EntityId fistsId = pOwner->GetInventory()?pOwner->GetInventory()->GetItemByClass(CItem::sFistsClass):0;
if(fistsId)
pOwner->SelectItem(fistsId,true);
return;
}
}
CWeapon::Select(select);
}