当前位置: 首页>>代码示例>>C++>>正文


C++ IFireMode::GetProjectileId方法代码示例

本文整理汇总了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;
};
开发者ID:super-nova,项目名称:NovaRepo,代码行数:34,代码来源:C4.cpp

示例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);
	}
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:35,代码来源:Detonate.cpp

示例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;
}
开发者ID:Arnm7890,项目名称:CryGame,代码行数:21,代码来源:C4.cpp

示例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);
}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:42,代码来源:C4.cpp


注:本文中的IFireMode::GetProjectileId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。