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


C++ IVehicleSeat::IsDriver方法代码示例

本文整理汇总了C++中IVehicleSeat::IsDriver方法的典型用法代码示例。如果您正苦于以下问题:C++ IVehicleSeat::IsDriver方法的具体用法?C++ IVehicleSeat::IsDriver怎么用?C++ IVehicleSeat::IsDriver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVehicleSeat的用法示例。


在下文中一共展示了IVehicleSeat::IsDriver方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: IndicateHit

void CHUD::IndicateHit(bool enemyIndicator,IEntity *pEntity, bool explosionFeedback)
{
	CPlayer *pPlayer = static_cast<CPlayer *>(gEnv->pGame->GetIGameFramework()->GetClientActor());
	if(!pPlayer)
		return;

	if(explosionFeedback)
		PlaySound(ESound_SpecialHitFeedback);

	if(!pPlayer->GetLinkedVehicle())
		m_pHUDCrosshair->GetFlashAnim()->Invoke("indicateHit");
	else
	{
		IVehicleSeat *pSeat = pPlayer->GetLinkedVehicle()->GetSeatForPassenger(pPlayer->GetEntityId());
		if(pSeat && !pSeat->IsDriver())
			m_pHUDCrosshair->GetFlashAnim()->Invoke("indicateHit");
		else
		{
			m_pHUDVehicleInterface->m_animMainWindow.Invoke("indicateHit", enemyIndicator);

			if(pEntity && !gEnv->bMultiplayer)
			{
				float r = ((unsigned char) ((g_pGameCVars->hud_colorLine >> 16)	& 0xFF)) / 255.0f;
				float g = ((unsigned char) ((g_pGameCVars->hud_colorLine >> 8)	& 0xFF)) / 255.0f;
				float b = ((unsigned char) ((g_pGameCVars->hud_colorLine >> 0)	& 0xFF)) / 255.0f;

				// It should be useless to test if pEntity is an enemy (it's already done by caller func)
				IActor *pActor = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pEntity->GetId());
				if(pActor)
					m_pHUDSilhouettes->SetSilhouette(pActor,r,g,b,1.0f,5.0f,true);
				else if(IVehicle *pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(pEntity->GetId()))
					m_pHUDSilhouettes->SetSilhouette(pVehicle,r,g,b,1.0f,5.0f);
			}
		}
	}
开发者ID:mrwonko,项目名称:CrysisVR,代码行数:35,代码来源:HUDInterfaceEffects.cpp

示例2: OnAction

//------------------------------------------------------------------------
void CVehicleClient::OnAction(IVehicle* pVehicle, EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
	assert(pVehicle);
 	if (!pVehicle)
		return;
	
  TActionNameIdMap::const_iterator ite = m_actionNameIds.find(actionId);
	if (ite == m_actionNameIds.end())
    return;

	IVehicleMovement *pMovement = pVehicle->GetMovement();
	const bool isAir = pMovement && pMovement->GetMovementType()==IVehicleMovement::eVMT_Air;

	IVehicleSeat* pCurrentSeat = pVehicle->GetSeatForPassenger(actorId);
	const bool isThirdPerson = pCurrentSeat && pCurrentSeat->GetView(pCurrentSeat->GetCurrentView())->IsThirdPerson();
	const bool isDriver = pCurrentSeat && pCurrentSeat->IsDriver();

	switch (ite->second)
  {
  case (eVAI_XIMoveX):	
    {
			if(pMovement && pMovement->GetMovementType() == IVehicleMovement::eVMT_Air)
			{
				//strafe instead of turning for air vehicles
				if(value>0.f)
				{
					pVehicle->OnAction(eVAI_StrafeRight, eAAM_OnPress, value, actorId);
					m_bMovementFlagRight = true;
				}
				else if(value==0.f)
				{
					if(m_bMovementFlagRight)
					{
						pVehicle->OnAction(eVAI_StrafeRight, eAAM_OnRelease, 0.f, actorId);
						m_bMovementFlagRight = false;
					}
					else if(m_bMovementFlagLeft)
					{
						pVehicle->OnAction(eVAI_StrafeLeft, eAAM_OnRelease, 0.f, actorId);
						m_bMovementFlagLeft = false;
					}
				}
				else//value<0
				{
					pVehicle->OnAction(eVAI_StrafeLeft, eAAM_OnPress, -value, actorId);
					m_bMovementFlagLeft = true;
				}
			}
			else
			{
				if(value>0.f)
				{
					pVehicle->OnAction(eVAI_TurnRight, eAAM_OnPress, value, actorId);
					m_bMovementFlagRight = true;
				}
				else if(value==0.f)
				{
					if(m_bMovementFlagRight)
					{
						pVehicle->OnAction(eVAI_TurnRight, eAAM_OnRelease, 0.f, actorId);
						m_bMovementFlagRight = false;
					}
					else if(m_bMovementFlagLeft)
					{
						pVehicle->OnAction(eVAI_TurnLeft, eAAM_OnRelease, 0.f, actorId);
						m_bMovementFlagLeft = false;
					}
				}
				else//value<0
				{
					pVehicle->OnAction(eVAI_TurnLeft, eAAM_OnPress, -value, actorId);
					m_bMovementFlagLeft = true;
				}
			}
			break;
		}
  case (eVAI_XIMoveY):
		{
			EVehicleActionIds eForward = eVAI_MoveForward;
			EVehicleActionIds eBack = eVAI_MoveBack;
			if(!strcmp("Asian_helicopter",pVehicle->GetEntity()->GetClass()->GetName()))
			{
				eForward = eVAI_MoveUp;
				eBack = eVAI_MoveDown;
			}

			if(value>0.f)
			{
				pVehicle->OnAction(eForward, eAAM_OnPress, value, actorId);
				m_bMovementFlagForward = true;
			}
			else if(value==0.f)
			{
				if(m_bMovementFlagForward)
				{
					pVehicle->OnAction(eForward, eAAM_OnRelease, 0.f, actorId);
					m_bMovementFlagForward = false;
				}
				else if(m_bMovementFlagBack)
//.........这里部分代码省略.........
开发者ID:nhnam,项目名称:Seasons,代码行数:101,代码来源:VehicleClient.cpp


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