本文整理汇总了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);
}
}
}
示例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();
}
}
}
}
}
示例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);
}
}
}
}