public static void CreateCameraOfBattleSpine() { if (CamerasMgr.CameraOfBattleSpine != null && CamerasMgr.CameraOfBattleSpine.get_transform() != null) { CamerasMgr.CameraOfBattleSpine.get_gameObject().SetActive(true); } else { GameObject gameObject = new GameObject(); gameObject.set_name("Camera2BattleSpineScreen"); gameObject.get_transform().set_parent(null); CamerasMgr.CameraOfBattleSpine = gameObject.AddComponent <Camera>(); CamerasMgr.CameraOfBattleSpine.set_clearFlags(1); CamerasMgr.CameraOfBattleSpine.set_cullingMask(LayerSystem.GetMask(CamerasMgr.battle_spine_layerss)); CamerasMgr.CameraOfBattleSpine.set_depth(CamerasMgr.CameraMain.get_depth() - 1f); GameObject gameObject2 = AssetManager.AssetOfNoPool.LoadAssetNowNoAB("UGUI/Prefabs/GlobalUI/UICanvasNoEvents", typeof(Object)) as GameObject; if (gameObject2 == null) { return; } CamerasMgr._canvasOfBattleSpine = UGUITools.AddChild(CamerasMgr.CameraOfBattleSpine.get_gameObject(), gameObject2, false, "_canvasOfBattleSpine").get_transform(); Canvas component = CamerasMgr._canvasOfBattleSpine.GetComponent <Canvas>(); if (component != null) { component.set_worldCamera(CamerasMgr.CameraOfBattleSpine); component.get_gameObject().SetActive(true); component.set_planeDistance(100f); component.set_sortingOrder(1000); } } }
public static int GetCullingMask(int classify) { int num = 0; switch (classify) { case 1: num = -1; break; case 2: num = 0; break; case 3: num = LayerSystem.GetMask(Utils.background_layers); break; case 4: num = -1; for (int i = 0; i < Utils.background_layers.Length; i++) { num &= ~(1 << LayerSystem.NameToLayer(Utils.background_layers[i])); } break; case 5: num = LayerSystem.GetMask(Utils.win_layers); break; case 6: num = LayerSystem.GetMask(Utils.timeline_layers); break; case 7: num = -1; for (int j = 0; j < Utils.pet_ultra_skill_no_layers.Length; j++) { num &= ~(1 << LayerSystem.NameToLayer(Utils.pet_ultra_skill_no_layers[j])); } break; case 8: num = -1; for (int k = 0; k < Utils.no_camerarange_layers.Length; k++) { num &= ~(1 << LayerSystem.NameToLayer(Utils.no_camerarange_layers[k])); } break; case 9: num = LayerSystem.GetMask(Utils.camerarange_layers); break; } return(num); }
public static void SelectRoleSettingOn() { if (PPToSelectRoleSetting.focusCamera == null) { GameObject gameObject = new GameObject(); gameObject.set_name("FocusCamera"); gameObject.get_transform().set_parent(CamerasMgr.MainCameraRoot.get_transform()); gameObject.get_transform().set_localPosition(new Vector3(0f, 0f, 0f)); gameObject.get_transform().set_localScale(new Vector3(1f, 1f, 1f)); gameObject.get_transform().set_localRotation(Quaternion.get_identity()); PPToSelectRoleSetting.focusCamera = gameObject.AddComponent <Camera>(); PPToSelectRoleSetting.focusCamera.set_cullingMask(LayerSystem.GetMask(Utils.no_camerarange_layers)); PPToSelectRoleSetting.focusCamera.set_clearFlags(3); PPToSelectRoleSetting.focusCamera.set_orthographic(false); PPToSelectRoleSetting.focusCamera.set_farClipPlane(CamerasMgr.CameraMain.get_farClipPlane()); PPToSelectRoleSetting.focusCamera.set_nearClipPlane(CamerasMgr.CameraMain.get_nearClipPlane()); PPToSelectRoleSetting.focusCamera.set_fieldOfView(CamerasMgr.CameraMain.get_fieldOfView()); PPToSelectRoleSetting.focusCamera.set_depth(CamerasMgr.CameraMain.get_depth() + 1f); PPToSelectRoleSetting.focusCamera.set_useOcclusionCulling(false); PPToSelectRoleSetting.focusCamera.set_enabled(true); } CamerasMgr.CameraMain.set_cullingMask(Utils.GetCullingMask(8)); }
private void SetCameraRenderType(RTManager.RtType type, bool typeOn) { this.ResetRotation(); switch (type) { case RTManager.RtType.LocalHeatDistortion: { string[] array = new string[] { "FX_Distortion" }; int mask = LayerMask.GetMask(array); this.SetCameraCullingMask(type, typeOn, mask); break; } case RTManager.RtType.Player: { if (EntityWorld.Instance.ActSelf != null) { ShadowController.ShowShadow(EntityWorld.Instance.EntSelf.ID, EntityWorld.Instance.ActSelf, typeOn, 0); } string[] layerNames = new string[] { "CameraRange" }; int mask2 = LayerSystem.GetMask(layerNames); this.SetCameraCullingMask(type, typeOn, mask2); if (typeOn) { this.AimTargetOffsetY = ModelDisplayManager.GetPlayerAM().camProjPosRevise; if (ModelDisplayManager.GetPlayerAM().camProjRotRevise.get_Count() >= 2) { RTManager.Instance.CamProjRotateRevise = new Vector3(0f, ModelDisplayManager.GetPlayerAM().camProjRotRevise.get_Item(0), ModelDisplayManager.GetPlayerAM().camProjRotRevise.get_Item(1)); } } break; } case RTManager.RtType.ActorModel1: this.SetCameraCullingMask(type, typeOn, ModelDisplayManager.ModelFXMask); if (!typeOn) { this.HideModel(); CamerasMgr.SetRTCClippingPlanes(0f); } else { CamerasMgr.SetRTCClippingPlanes(100000f); } break; case RTManager.RtType.InstanceBall: { string[] layerNames2 = new string[] { "BallItem", "BallObject" }; int mask3 = LayerSystem.GetMask(layerNames2); this.SetCameraCullingMask(type, typeOn, mask3); if (!typeOn) { this.HideModel(); } break; } case RTManager.RtType.ElementBall: { string[] layerNames3 = new string[] { "BallItem", "BallObject" }; int mask4 = LayerSystem.GetMask(layerNames3); this.SetCameraCullingMask(type, typeOn, mask4); if (!typeOn) { this.HideModel(); } break; } } }
private Vector3 GetRangePointBy2(Vector3 dstPos) { if (this.target != null) { RaycastHit raycastHit; bool flag = Physics.Linecast(this.target.get_position(), dstPos, ref raycastHit, LayerSystem.GetMask(CameraRange.CameraRangeLayers)); if (flag) { float num = Mathf.Abs(this.target.get_transform().get_position().x - dstPos.x); float num2 = Mathf.Abs(this.target.get_transform().get_position().y - dstPos.y); float num3 = Mathf.Abs(this.target.get_transform().get_position().x - raycastHit.get_point().x); float num4 = Mathf.Pow(num, 2f) + Mathf.Pow(num2, 2f) - Mathf.Pow(num3, 2f); num4 = Mathf.Pow(num4, 0.5f) + this.target.get_transform().get_position().y; return(new Vector3(raycastHit.get_point().x, num4, raycastHit.get_point().z)); } } return(dstPos); }
private Vector3 GetRangePointBy1(Vector3 dstPos) { if (this.target != null) { RaycastHit raycastHit; bool flag = Physics.Linecast(this.target.get_position(), dstPos, ref raycastHit, LayerSystem.GetMask(CameraRange.CameraRangeLayers)); if (flag) { return(raycastHit.get_point()); } } return(dstPos); }