private void OnChangeViewToFps() { GameValues.isInFPSMode = true; m_locationCameraController.ChangeToFpsView(); m_uiController.ChangeUIDueToLocationChange(GameViewState.IsInFps, InsideFieldLocation.None); LocationAndPosition locationEntity = new LocationAndPosition(InsideFieldLocation.None, null); m_currentViewState.Add(new KeyValuePair <GameViewState, LocationAndPosition>(GameViewState.IsInFps, locationEntity)); }
public void GoToSpecificPoint(Transform pointView, GameViewState viewState, LocationAndPosition locationAndPosition) { bool preiousViewStateWasFPS = m_viewState == GameViewState.IsInFps; m_viewState = viewState; m_locationField = locationAndPosition.m_location; m_transformViewPoint = pointView; if (GameValuesConfig.FadeAnimation || preiousViewStateWasFPS) { UIController.Instance.FadeEffectController.ScreenTransition(0); } else { if (m_locationField != InsideFieldLocation.None) { if (m_locationField == InsideFieldLocation.SelectedInsideAsset || locationAndPosition.m_isFromBack) { UIController.Instance.FadeEffectController.ScreenTransition(0); } else { switch (m_locationField) { case InsideFieldLocation.WellHeads: m_translateCam_fromTopToTowerAnim.enabled = true; m_translateCam_fromTopToTowerAnim.Play("cam_TopToWellHeads_intro"); break; case InsideFieldLocation.Wireline: m_translateCam_fromTopToTowerAnim.enabled = true; m_translateCam_fromTopToTowerAnim.Play("cam_TopToWireLine_intro"); break; case InsideFieldLocation.Hse: m_translateCam_fromTopToTowerAnim.enabled = true; m_translateCam_fromTopToTowerAnim.Play("cam_TopToHSE_intro"); break; case InsideFieldLocation.DrillingTower: m_translateCam_fromTopToTowerAnim.enabled = true; m_translateCam_fromTopToTowerAnim.Play("cam_TopToTowerView_intro"); break; } } } else { UIController.Instance.FadeEffectController.ScreenTransition(0); } } }
public void Start() { EventManager.instance.addEventListener(HUDEvent.ON_CHANGE_TO_FPS_VIEW, this.gameObject, "OnChangeViewToFps"); EventManager.instance.addEventListener(HUDEvent.ON_BACK_TO_OTHER_VIEW, this.gameObject, "OnBackToPreviousView"); EventManager.instance.addEventListener(AssetUIEvent.ON_CHANGE_TO_INSIDE_VIEW, this.gameObject, "OnEnterToFieldEvent"); m_currentViewState = new GenericList <KeyValuePair <GameViewState, LocationAndPosition> >(); LocationAndPosition locationEntity = new LocationAndPosition(InsideFieldLocation.None, null); m_currentViewState.Add(new KeyValuePair <GameViewState, LocationAndPosition>(GameViewState.FieldView, locationEntity)); }
private void OnBackToPreviousView() { KeyValuePair <GameViewState, LocationAndPosition> currentState = m_currentViewState[m_currentViewState.Count - 1]; if (currentState.Key == GameViewState.InAnAsset && currentState.Value.m_location == InsideFieldLocation.WellHeads) { AssetEvent assetEvt = new AssetEvent(AssetEvent.ON_ACTIVE_WELLHEADS_COLLIDERS); assetEvt.arguments["active"] = false; EventManager.instance.dispatchEvent(assetEvt); } m_currentViewState.PopBack(); if (m_currentViewState.Count > 1) { KeyValuePair <GameViewState, LocationAndPosition> state = m_currentViewState[m_currentViewState.Count - 1]; LocationAndPosition locationEntity = state.Value; locationEntity.m_isFromBack = true; m_uiController.ChangeUIDueToLocationChange(state.Key, locationEntity.m_location); switch (state.Key) { case GameViewState.InAnAsset: m_locationCameraController.GoToSpecificPoint(locationEntity.m_transformPosition, state.Key, locationEntity); break; case GameViewState.IsInFps: GameValues.isInFPSMode = true; AssetUIEvent assetUIEvent = new AssetUIEvent(AssetUIEvent.ON_ENABLE_COLLIDER); EventManager.instance.dispatchEvent(assetUIEvent); m_locationCameraController.ChangeToFpsView(); break; } } else if (m_currentViewState.Count == 1) { GameValues.isInFPSMode = false; GameValues.disableOrbit = false; m_locationCameraController.GotoTopView(); m_uiController.ChangeUIDueToLocationChange(GameViewState.FieldView, InsideFieldLocation.None); AssetUIEvent assetUIEvent = new AssetUIEvent(AssetUIEvent.ON_ENABLE_COLLIDER); EventManager.instance.dispatchEvent(assetUIEvent); } else { GameStateManager.Instance.PopState(); } }
//Go to scpecif location private void OnEnterToFieldEvent(AssetUIEvent evt) { GameValues.isInFPSMode = false; GameValues.disableOrbit = true; Transform viewPointTransform = (Transform)evt.arguments["navigationPoint"]; InsideFieldLocation location = (InsideFieldLocation)evt.arguments["insideFieldLocation"]; LocationAndPosition locationEntity = new LocationAndPosition(location, viewPointTransform); m_locationCameraController.GoToSpecificPoint(viewPointTransform, GameViewState.InAnAsset, locationEntity); m_uiController.ChangeUIDueToLocationChange(GameViewState.InAnAsset, location); m_currentViewState.Add(new KeyValuePair <GameViewState, LocationAndPosition>(GameViewState.InAnAsset, locationEntity)); }