Beispiel #1
0
        /// <summary>
        /// Initialize the SliderSets and ToggleSets which create and manage the UI
        /// </summary>
        private void InitStudioUI(Scene s, LoadSceneMode lsm)
        {
            if (s.name != "Studio")
            {
                return;
            }
            SceneManager.sceneLoaded -= InitStudioUI;

#if KK
            CameraLayerDefault = Camera.main.gameObject.layer;
#else
            CameraLayerDefault = 1;
#endif

#if AI || HS2
            //Add a custom collider controller to the camera
            var mainCamera = GameObject.Find("StudioScene/Camera/CameraSet/MainCamera");

            studioCameraColliderControllerGO      = new GameObject();
            studioCameraColliderControllerGO.name = "StudioCameraColliderController";
            studioCameraColliderControllerGO.AddComponent <StudioCameraColliderController>();
            var rigidbody = studioCameraColliderControllerGO.AddComponent <Rigidbody>();
            rigidbody.useGravity  = false;
            rigidbody.isKinematic = true;
            var collider = studioCameraColliderControllerGO.GetOrAddComponent <CapsuleCollider>();
            collider.radius    = 0.05f;
            collider.isTrigger = true;
            collider.direction = 2;

            var cameraControllerGO = GameObject.Find("StudioScene/Camera/CameraSet/CameraController");
            var cameraController   = cameraControllerGO.GetComponent <Studio.CameraControl>();
            Traverse.Create(cameraController).Field("viewCollider").SetValue(collider);
            studioCameraColliderControllerGO.transform.SetParent(mainCamera.transform);
            studioCameraColliderControllerGO.transform.localPosition    = new Vector3(0f, 0f, 0f);
            studioCameraColliderControllerGO.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
            studioCameraColliderControllerGO.layer = CameraLayerDefault;
#endif

            var menu = new SceneEffectsCategory(StudioSceneSettings.PluginNameInternal);
            MapMasking     = menu.AddToggleSet("Map Masking", MapMaskingSetter, false);
            NearClipPlane  = menu.AddSliderSet("Near Clip Plane", NearClipSetter, NearClipDefault, 0.01f, 10f);
            FarClipPlane   = menu.AddSliderSet("Far Clip Plane", FarClipSetter, FarClipDefault, 1f, 10000f);
            ShadowDistance = menu.AddSliderSet("Shadow Distance", ShadowDistanceSetter, ShadowDistanceDefault, 1f, 1000f);

            NearClipPlane.EnforceSliderMaximum  = false;
            FarClipPlane.EnforceSliderMaximum   = false;
            ShadowDistance.EnforceSliderMaximum = false;
        }
Beispiel #2
0
        /// <summary>
        /// Initialize the SliderSets and ToggleSets which create and manage the UI
        /// </summary>
        private void InitStudioUI(Scene s, LoadSceneMode lsm)
        {
            if (s.name != "Studio")
            {
                return;
            }
            SceneManager.sceneLoaded -= InitStudioUI;

            var CameraLayerDefault = Camera.main.gameObject.layer;

            var menu = new SceneEffectsCategory(StudioSceneSettingsPlugin.PluginNameInternal);

#if KK
            MapMasking = menu.AddToggleSet("Map Masking", value => Camera.main.gameObject.layer = value ? StudioSceneSettingsCore.CameraMapMaskingLayer : CameraLayerDefault, false);
#endif
            NearClipPlane = menu.AddSliderSet("Near Clip Plane", value => NearClipSetter(value), NearClipDefault, 0.01f, 10f);
            FarClipPlane  = menu.AddSliderSet("Far Clip Plane", value => FarClipSetter(value), FarClipDefault, 1f, 10000f);

            NearClipPlane.EnforceSliderMaximum = false;
            FarClipPlane.EnforceSliderMaximum  = false;
        }