void Cleanup() { if (m_bActive) { SetActive(false); } if (!m_bNeedsCleanup) return; m_bNeedsCleanup = false; IFlowGraph* pGraph = m_actInfo.pGraph; if (pGraph) { pGraph->SetRegularlyUpdated(m_actInfo.myID, false); } IVehicle* pVehicle; pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(m_entityId); if (pVehicle) { pVehicle->UnregisterVehicleEventListener(this); } }
//------------------------------------------------------------------------ CVehicleWeapon::~CVehicleWeapon() { IVehicle* pVehicle = GetVehicle(); if(pVehicle) { pVehicle->UnregisterVehicleEventListener(this); } AudioCache(false); //uncache whatever is loaded }
void CFlowNode_AISequenceAction_ApproachAndEnterVehicle::UnregisterFromVehicleEvent(IVehicleSeat* pVehicleSeatHint) { IVehicle* pVehicle = NULL; if (pVehicleSeatHint) { pVehicle = pVehicleSeatHint->GetVehicle(); } else { const bool alsoCheckForCrewHostility = false; pVehicle = GetVehicle(alsoCheckForCrewHostility); } if (pVehicle) { pVehicle->UnregisterVehicleEventListener(this); } }
//------------------------------------------------------------------------ void CVehicleWeapon::StopUse(EntityId userId) { if (m_owner.GetId() && userId != m_owner.GetId()) return; if(userId == g_pGame->GetIGameFramework()->GetClientActorId()) { IVehicle* pVehicle = GetVehicle(); if(pVehicle) { pVehicle->UnregisterVehicleEventListener(this); } AudioCache(true, true); //change cache to third person if it's not available } Select(false); m_stats.used = false; SetOwnerId(0); EnableUpdate(false); if(IsZoomed() || IsZoomingInOrOut()) { ExitZoom(); } m_shootCounter = 0; if (userId == g_pGame->GetIGameFramework()->GetClientActorId()) { SHUDEvent event; event.eventType = eHUDEvent_OnItemSelected; event.eventIntData = 0; CHUDEventDispatcher::CallEvent(event); } }