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


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

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


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

示例1: LockSeats

void CVTOLVehicleManager::LockSeats(IVehicle* pVehicle, bool lock)
{
	EVehicleSeatLockStatus newStatus = lock ? eVSLS_LockedForPlayers : eVSLS_Unlocked;

	const int numSeats = pVehicle->GetSeatCount();
	for(int i = 1; i <= numSeats; ++i)
	{
		IVehicleSeat* pSeat = pVehicle->GetSeatById(i);
		if(pSeat && pSeat->GetLockedStatus() != eVSLS_Locked)
		{
			pSeat->SetLocked(newStatus);
		}
	}
}
开发者ID:souxiaosou,项目名称:FireNET,代码行数:14,代码来源:VTOLVehicleManager.cpp

示例2: SetActive

	void SetActive(const bool bActive)
	{
		if (m_bActive == bActive)
			return;

		m_bActive = bActive;

		IVehicle* pVehicle;
		pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(m_entityId);

		if (bActive)
		{
			CRY_ASSERT(pVehicle);
			m_fStartedTime = gEnv->pTimer->GetFrameStartTime().GetSeconds();
			m_actInfo.pGraph->SetRegularlyUpdated(m_actInfo.myID, true);

			if (pVehicle)
			{
				pVehicle->RegisterVehicleEventListener(this, "CFlowVehicleDriveForward");
			}

			ActivateOutput(&m_actInfo, EOP_Started, true);
		}
		else
		{
			m_bNeedsCleanup = true; // To ensure event listener gets cleaned up when its safe to do so

			if (pVehicle)
			{
				if (pVehicle->GetSeatCount() != 0) // Restore back
				{
					IVehicleSeat* pSeat = pVehicle->GetSeatById(1);
					if (pSeat)
					{
						pSeat->SetLocked(m_prevSeatLockStatus);
						//pSeat->ExitRemotely();
					}
				}
			}
		}
	}
开发者ID:danielasun,项目名称:dbho-GameSDK,代码行数:41,代码来源:FlowVehicleNodes.cpp

示例3: ProcessEvent

	virtual void ProcessEvent(EFlowEvent flowEvent, SActivationInfo* pActivationInfo)
	{
		if (flowEvent == eFE_Activate && IsPortActive(pActivationInfo, EIP_StartDriving))
		{
			IEntity* pEntity = pActivationInfo->pEntity;
			if(!pEntity)
				return;

			IVehicle* pVehicle;
			pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle( pEntity->GetId() );
			if(!pVehicle || pVehicle->IsDestroyed())
			{
				return;
			}

			IVehicleMovement* pMovement = pVehicle->GetMovement();
			if (!pMovement)
				return;

			CVehicleMovementBase* pMovementBase = StaticCast_CVehicleMovementBase(pMovement);
			if (!pMovementBase)
				return;

			IActor* pPlayer = g_pGame->GetIGameFramework()->GetClientActor();
			if (!pPlayer)
				return;

			const EntityId localPlayer = pPlayer->GetEntityId();
			if (pVehicle->GetSeatCount() == 0) // Don't need to remotely enter
			{
				pMovement->StartDriving(localPlayer);
			}
			else
			{
				pVehicle->EvictAllPassengers();

				IVehicleSeat* pSeat = pVehicle->GetSeatById(1);
				if (pSeat)
				{
					// Can't use remote entering to control otherwise if vehicle blows up, player dies
					//pSeat->EnterRemotely(localPlayer);

					pMovement->StartDriving(localPlayer);
					m_prevSeatLockStatus = pSeat->GetLockedStatus();
					pSeat->SetLocked(eVSLS_Locked);
				}
			}

			m_fDuration = GetPortFloat(pActivationInfo, EIP_Time);
			m_fSpeed = GetPortFloat(pActivationInfo, EIP_Speed);
			m_actInfo = *pActivationInfo;
			m_entityId = pEntity->GetId();
			
			SetActive(true);
		}
		else if (flowEvent == eFE_Update)
		{
			if (!m_bActive)
			{
				if (m_bNeedsCleanup)
				{
					Cleanup();
				}

				return;
			}

			IEntity* pEntity = pActivationInfo->pEntity;
			if(!pEntity)
			{
				SetActive(false);
				return;
			}

			IVehicle* pVehicle;
			pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle( pEntity->GetId() );
			if(!pVehicle || pVehicle->IsDestroyed())
			{
				SetActive(false);
				return;
			}

			const float curTime = gEnv->pTimer->GetFrameStartTime().GetSeconds();
			if ((curTime - m_fStartedTime) >= m_fDuration)
			{
				SetActive(false);

				ActivateOutput(pActivationInfo, EOP_TimeComplete, true);
			}
			else // Update every frame
			{
				IVehicleMovement* pMovement = pVehicle->GetMovement();
				if (pMovement)
				{
					// prevent full pedal being kept pressed, but give it a bit
					pMovement->OnAction(eVAI_MoveForward, eAAM_OnPress, 1.0f);
				}
			}
		}
	}
开发者ID:danielasun,项目名称:dbho-GameSDK,代码行数:100,代码来源:FlowVehicleNodes.cpp


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