private void SyncVisualization()
 {
     if (!base.enabled)
     {
         return;
     }
     if (this.m_PlaneVisualizationType != CollisionModuleUI.PlaneVizType.Solid)
     {
         return;
     }
     for (int i = 0; i < this.m_ShownPlanes.Length; i++)
     {
         UnityEngine.Object objectReferenceValue = this.m_ShownPlanes[i].objectReferenceValue;
         if (!(objectReferenceValue == null))
         {
             Transform transform = objectReferenceValue as Transform;
             if (!(transform == null))
             {
                 GameObject plane = ParticleEffectUtils.GetPlane(i);
                 plane.transform.position   = transform.position;
                 plane.transform.rotation   = transform.rotation;
                 plane.transform.localScale = new Vector3(this.m_ScaleGrid, this.m_ScaleGrid, this.m_ScaleGrid);
             }
         }
     }
 }
Esempio n. 2
0
        public void Clear()
        {
            ParticleSystem root = this.GetRoot();

            if (this.ShouldManagePlaybackState(root) && (root != null))
            {
                PlayState playing;
                if (this.IsPlaying())
                {
                    playing = PlayState.Playing;
                }
                else if (this.IsPaused())
                {
                    playing = PlayState.Paused;
                }
                else
                {
                    playing = PlayState.Stopped;
                }
                int instanceID = root.GetInstanceID();
                SessionState.SetVector3("SimulationState" + instanceID, new Vector3((float)instanceID, (float)playing, ParticleSystemEditorUtils.editorPlaybackTime));
            }
            this.m_ParticleSystemCurveEditor.OnDisable();
            ParticleEffectUtils.ClearPlanes();
            Tools.s_Hidden = false;
            if (root != null)
            {
                SessionState.SetBool("ShowSelected" + root.GetInstanceID(), this.m_ShowOnlySelectedMode);
            }
            this.SetShowOnlySelectedMode(false);
            GameView.RepaintAll();
            SceneView.RepaintAll();
        }
 private void SyncVisualization()
 {
     if (base.enabled)
     {
         if (this.m_PlaneVisualizationType == CollisionModuleUI.PlaneVizType.Solid)
         {
             for (int i = 0; i < this.m_ShownPlanes.Length; i++)
             {
                 UnityEngine.Object objectReferenceValue = this.m_ShownPlanes[i].objectReferenceValue;
                 if (objectReferenceValue == null)
                 {
                     ParticleEffectUtils.HidePlaneIfExists(i);
                 }
                 else
                 {
                     Transform transform = objectReferenceValue as Transform;
                     if (transform == null)
                     {
                         ParticleEffectUtils.HidePlaneIfExists(i);
                     }
                     else
                     {
                         GameObject plane = ParticleEffectUtils.GetPlane(i);
                         plane.transform.position   = transform.position;
                         plane.transform.rotation   = transform.rotation;
                         plane.transform.localScale = new Vector3(this.m_ScaleGrid, this.m_ScaleGrid, this.m_ScaleGrid);
                         plane.transform.position  += transform.up.normalized * 0.002f;
                     }
                 }
             }
         }
     }
 }
Esempio n. 4
0
        public override void OnSceneGUI(ParticleSystem s, InitialModuleUI initial)
        {
            Event     current = Event.current;
            EventType rawType = current.type;

            if ((current.type == EventType.Ignore) && (current.rawType == EventType.MouseUp))
            {
                rawType = current.rawType;
            }
            Color color  = Handles.color;
            Color color2 = new Color(1f, 1f, 1f, 0.5f);

            Handles.color = color2;
            if (this.m_Type.intValue == 0)
            {
                for (int i = 0; i < this.m_ShownPlanes.Length; i++)
                {
                    UnityEngine.Object objectReferenceValue = this.m_ShownPlanes[i].objectReferenceValue;
                    if (objectReferenceValue != null)
                    {
                        Transform objB = objectReferenceValue as Transform;
                        if (objB != null)
                        {
                            Vector3    position = objB.position;
                            Quaternion rotation = objB.rotation;
                            Vector3    vector2  = (Vector3)(rotation * Vector3.right);
                            Vector3    normal   = (Vector3)(rotation * Vector3.up);
                            Vector3    vector4  = (Vector3)(rotation * Vector3.forward);
                            if (object.ReferenceEquals(s_SelectedTransform, objB))
                            {
                                Tools.s_Hidden = true;
                                EditorGUI.BeginChangeCheck();
                                if (Tools.current == UnityEditor.Tool.Move)
                                {
                                    objB.position = Handles.PositionHandle(position, rotation);
                                }
                                else if (Tools.current == UnityEditor.Tool.Rotate)
                                {
                                    objB.rotation = Handles.RotationHandle(rotation, position);
                                }
                                if (EditorGUI.EndChangeCheck())
                                {
                                    if (this.m_PlaneVisualizationType == PlaneVizType.Solid)
                                    {
                                        GameObject plane = ParticleEffectUtils.GetPlane(i);
                                        plane.transform.position   = position;
                                        plane.transform.rotation   = rotation;
                                        plane.transform.localScale = new Vector3(this.m_ScaleGrid, this.m_ScaleGrid, this.m_ScaleGrid);
                                    }
                                    ParticleSystemEditorUtils.PerformCompleteResimulation();
                                }
                            }
                            else
                            {
                                int   keyboardControl = GUIUtility.keyboardControl;
                                float size            = HandleUtility.GetHandleSize(position) * 0.06f;
                                if (< > f__mg$cache0 == null)
                                {
 public override void OnInspectorGUI(ParticleSystem s)
 {
     if (CollisionModuleUI.s_Texts == null)
     {
         CollisionModuleUI.s_Texts = new CollisionModuleUI.Texts();
     }
     string[] options = new string[]
     {
         "Planes",
         "World"
     };
     CollisionModuleUI.CollisionTypes collisionTypes = (CollisionModuleUI.CollisionTypes)ModuleUI.GUIPopup(string.Empty, this.m_Type, options);
     if (collisionTypes == CollisionModuleUI.CollisionTypes.Plane)
     {
         this.DoListOfPlanesGUI();
         EditorGUI.BeginChangeCheck();
         this.m_PlaneVisualizationType = (CollisionModuleUI.PlaneVizType)ModuleUI.GUIPopup(CollisionModuleUI.s_Texts.visualization, (int)this.m_PlaneVisualizationType, this.m_PlaneVizTypeNames);
         if (EditorGUI.EndChangeCheck())
         {
             EditorPrefs.SetInt("PlaneColisionVizType", (int)this.m_PlaneVisualizationType);
             if (this.m_PlaneVisualizationType == CollisionModuleUI.PlaneVizType.Solid)
             {
                 this.SyncVisualization();
             }
             else
             {
                 ParticleEffectUtils.ClearPlanes();
             }
         }
         EditorGUI.BeginChangeCheck();
         this.m_ScaleGrid = ModuleUI.GUIFloat(CollisionModuleUI.s_Texts.scalePlane, this.m_ScaleGrid, "f2");
         if (EditorGUI.EndChangeCheck())
         {
             this.m_ScaleGrid = Mathf.Max(0f, this.m_ScaleGrid);
             EditorPrefs.SetFloat("ScalePlaneColision", this.m_ScaleGrid);
             this.SyncVisualization();
         }
     }
     ModuleUI.GUIFloat(CollisionModuleUI.s_Texts.dampen, this.m_Dampen);
     ModuleUI.GUIFloat(CollisionModuleUI.s_Texts.bounce, this.m_Bounce);
     ModuleUI.GUIFloat(CollisionModuleUI.s_Texts.lifetimeLoss, this.m_LifetimeLossOnCollision);
     ModuleUI.GUIFloat(CollisionModuleUI.s_Texts.minKillSpeed, this.m_MinKillSpeed);
     if (collisionTypes != CollisionModuleUI.CollisionTypes.World)
     {
         ModuleUI.GUIFloat(CollisionModuleUI.s_Texts.particleRadius, this.m_ParticleRadius);
     }
     if (collisionTypes == CollisionModuleUI.CollisionTypes.World)
     {
         ModuleUI.GUILayerMask(CollisionModuleUI.s_Texts.collidesWith, this.m_CollidesWith);
         ModuleUI.GUIPopup(CollisionModuleUI.s_Texts.quality, this.m_Quality, CollisionModuleUI.s_Texts.qualitySettings);
         if (this.m_Quality.intValue > 0)
         {
             ModuleUI.GUIFloat(CollisionModuleUI.s_Texts.voxelSize, this.m_VoxelSize);
         }
     }
     ModuleUI.GUIToggle(CollisionModuleUI.s_Texts.collisionMessages, this.m_CollisionMessages);
 }
 protected override void SetVisibilityState(ModuleUI.VisibilityState newState)
 {
     base.SetVisibilityState(newState);
     if (newState != ModuleUI.VisibilityState.VisibleAndFoldedOut)
     {
         Tools.s_Hidden = false;
         CollisionModuleUI.m_SelectedTransform = (Transform)null;
         ParticleEffectUtils.ClearPlanes();
     }
     else
     {
         this.SyncVisualization();
     }
 }
        public void Clear()
        {
            ParticleSystem root = this.GetRoot();

            if (this.ShouldManagePlaybackState(root) && (UnityEngine.Object)root != (UnityEngine.Object)null)
            {
                ParticleEffectUI.PlayState playState = !this.IsPlaying() ? (!this.IsPaused() ? ParticleEffectUI.PlayState.Stopped : ParticleEffectUI.PlayState.Paused) : ParticleEffectUI.PlayState.Playing;
                int instanceId = root.GetInstanceID();
                SessionState.SetVector3("SimulationState" + (object)instanceId, new Vector3((float)instanceId, (float)playState, ParticleSystemEditorUtils.editorPlaybackTime));
            }
            this.m_ParticleSystemCurveEditor.OnDisable();
            ParticleEffectUtils.ClearPlanes();
            Tools.s_Hidden = false;
            if ((UnityEngine.Object)root != (UnityEngine.Object)null)
            {
                SessionState.SetBool("ShowSelected" + (object)root.GetInstanceID(), this.m_ShowOnlySelectedMode);
            }
            this.SetShowOnlySelectedMode(false);
            GameView.RepaintAll();
            SceneView.RepaintAll();
        }
 private void SyncVisualization()
 {
     if (!this.enabled || this.m_PlaneVisualizationType != CollisionModuleUI.PlaneVizType.Solid)
     {
         return;
     }
     for (int index = 0; index < this.m_ShownPlanes.Length; ++index)
     {
         Object objectReferenceValue = this.m_ShownPlanes[index].objectReferenceValue;
         if (!(objectReferenceValue == (Object)null))
         {
             Transform transform = objectReferenceValue as Transform;
             if (!((Object)transform == (Object)null))
             {
                 GameObject plane = ParticleEffectUtils.GetPlane(index);
                 plane.transform.position   = transform.position;
                 plane.transform.rotation   = transform.rotation;
                 plane.transform.localScale = new Vector3(this.m_ScaleGrid, this.m_ScaleGrid, this.m_ScaleGrid);
                 plane.transform.position  += transform.up.normalized * (1f / 500f);
             }
         }
     }
 }
Esempio n. 9
0
 private void SyncVisualization()
 {
     if (base.enabled && (this.m_PlaneVisualizationType == PlaneVizType.Solid))
     {
         for (int i = 0; i < this.m_ShownPlanes.Length; i++)
         {
             Object objectReferenceValue = this.m_ShownPlanes[i].objectReferenceValue;
             if (objectReferenceValue != null)
             {
                 Transform transform = objectReferenceValue as Transform;
                 if (transform != null)
                 {
                     GameObject plane = ParticleEffectUtils.GetPlane(i);
                     plane.transform.position   = transform.position;
                     plane.transform.rotation   = transform.rotation;
                     plane.transform.localScale = new Vector3(this.m_ScaleGrid, this.m_ScaleGrid, this.m_ScaleGrid);
                     Transform transform1 = plane.transform;
                     transform1.position += (Vector3)(transform.up.normalized * 0.002f);
                 }
             }
         }
     }
 }
        public override void OnSceneGUI(ParticleSystem s, InitialModuleUI initial)
        {
            Event     current   = Event.current;
            EventType eventType = current.type;

            if (current.type == EventType.Ignore && current.rawType == EventType.MouseUp)
            {
                eventType = current.rawType;
            }
            Color color1 = Handles.color;

            Handles.color = new Color(1f, 1f, 1f, 0.5f);
            if (this.m_Type.intValue == 0)
            {
                for (int index = 0; index < this.m_ShownPlanes.Length; ++index)
                {
                    Object objectReferenceValue = this.m_ShownPlanes[index].objectReferenceValue;
                    if (objectReferenceValue != (Object)null)
                    {
                        Transform transform = objectReferenceValue as Transform;
                        if ((Object)transform != (Object)null)
                        {
                            Vector3    position = transform.position;
                            Quaternion rotation = transform.rotation;
                            Vector3    axis1    = rotation * Vector3.right;
                            Vector3    normal   = rotation * Vector3.up;
                            Vector3    axis2    = rotation * Vector3.forward;
                            if (object.ReferenceEquals((object)CollisionModuleUI.m_SelectedTransform, (object)transform))
                            {
                                Tools.s_Hidden = true;
                                EditorGUI.BeginChangeCheck();
                                if (Tools.current == Tool.Move)
                                {
                                    transform.position = Handles.PositionHandle(position, rotation);
                                }
                                else if (Tools.current == Tool.Rotate)
                                {
                                    transform.rotation = Handles.RotationHandle(rotation, position);
                                }
                                if (EditorGUI.EndChangeCheck())
                                {
                                    if (this.m_PlaneVisualizationType == CollisionModuleUI.PlaneVizType.Solid)
                                    {
                                        GameObject plane = ParticleEffectUtils.GetPlane(index);
                                        plane.transform.position   = position;
                                        plane.transform.rotation   = rotation;
                                        plane.transform.localScale = new Vector3(this.m_ScaleGrid, this.m_ScaleGrid, this.m_ScaleGrid);
                                    }
                                    ParticleSystemEditorUtils.PerformCompleteResimulation();
                                }
                            }
                            else
                            {
                                int   keyboardControl = GUIUtility.keyboardControl;
                                float size            = HandleUtility.GetHandleSize(position) * 0.06f;
                                Handles.FreeMoveHandle(position, Quaternion.identity, size, Vector3.zero, new Handles.DrawCapFunction(Handles.RectangleCap));
                                if (eventType == EventType.MouseDown && current.type == EventType.Used && keyboardControl != GUIUtility.keyboardControl)
                                {
                                    CollisionModuleUI.m_SelectedTransform = transform;
                                    eventType = EventType.Used;
                                }
                            }
                            if (this.m_PlaneVisualizationType == CollisionModuleUI.PlaneVizType.Grid)
                            {
                                Color color2 = Handles.s_ColliderHandleColor * 0.9f;
                                if (!this.enabled)
                                {
                                    color2 = new Color(0.7f, 0.7f, 0.7f, 0.7f);
                                }
                                this.DrawGrid(position, axis1, axis2, normal, color2, index);
                            }
                            else
                            {
                                this.DrawSolidPlane(position, rotation, index);
                            }
                        }
                        else
                        {
                            Debug.LogError((object)("Not a transform: " + (object)objectReferenceValue.GetType()));
                        }
                    }
                }
            }
            Handles.color = color1;
        }
 protected override void OnModuleDisable()
 {
     base.OnModuleDisable();
     ParticleEffectUtils.ClearPlanes();
 }
        public override void OnInspectorGUI(ParticleSystem s)
        {
            if (CollisionModuleUI.s_Texts == null)
            {
                CollisionModuleUI.s_Texts = new CollisionModuleUI.Texts();
            }
            string[] options = new string[2] {
                "Planes", "World"
            };
            CollisionModuleUI.CollisionTypes collisionTypes = (CollisionModuleUI.CollisionTypes)ModuleUI.GUIPopup(string.Empty, this.m_Type, options);
            CollisionModuleUI.CollisionModes collisionModes = CollisionModuleUI.CollisionModes.Mode3D;
            if (collisionTypes == CollisionModuleUI.CollisionTypes.Plane)
            {
                this.DoListOfPlanesGUI();
                EditorGUI.BeginChangeCheck();
                this.m_PlaneVisualizationType = (CollisionModuleUI.PlaneVizType)ModuleUI.GUIPopup(CollisionModuleUI.s_Texts.visualization, (int)this.m_PlaneVisualizationType, this.m_PlaneVizTypeNames);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorPrefs.SetInt("PlaneColisionVizType", (int)this.m_PlaneVisualizationType);
                    if (this.m_PlaneVisualizationType == CollisionModuleUI.PlaneVizType.Solid)
                    {
                        this.SyncVisualization();
                    }
                    else
                    {
                        ParticleEffectUtils.ClearPlanes();
                    }
                }
                EditorGUI.BeginChangeCheck();
                this.m_ScaleGrid = ModuleUI.GUIFloat(CollisionModuleUI.s_Texts.scalePlane, this.m_ScaleGrid, "f2");
                if (EditorGUI.EndChangeCheck())
                {
                    this.m_ScaleGrid = Mathf.Max(0.0f, this.m_ScaleGrid);
                    EditorPrefs.SetFloat("ScalePlaneColision", this.m_ScaleGrid);
                    this.SyncVisualization();
                }
            }
            else
            {
                collisionModes = (CollisionModuleUI.CollisionModes)ModuleUI.GUIPopup(CollisionModuleUI.s_Texts.collisionMode, this.m_CollisionMode, new string[2] {
                    "3D", "2D"
                });
            }
            EditorGUI.BeginChangeCheck();
            this.m_VisualizeBounds = ModuleUI.GUIToggle(CollisionModuleUI.s_Texts.visualizeBounds, this.m_VisualizeBounds);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetBool("VisualizeBounds", this.m_VisualizeBounds);
            }
            CollisionModuleUI.s_LastInteractedEditor = this;
            ModuleUI.GUIMinMaxCurve(CollisionModuleUI.s_Texts.dampen, this.m_Dampen);
            ModuleUI.GUIMinMaxCurve(CollisionModuleUI.s_Texts.bounce, this.m_Bounce);
            ModuleUI.GUIMinMaxCurve(CollisionModuleUI.s_Texts.lifetimeLoss, this.m_LifetimeLossOnCollision);
            double num1 = (double)ModuleUI.GUIFloat(CollisionModuleUI.s_Texts.minKillSpeed, this.m_MinKillSpeed);

            if (collisionTypes != CollisionModuleUI.CollisionTypes.World || collisionModes == CollisionModuleUI.CollisionModes.Mode2D)
            {
                double num2 = (double)ModuleUI.GUIFloat(CollisionModuleUI.s_Texts.radiusScale, this.m_RadiusScale);
            }
            if (collisionTypes == CollisionModuleUI.CollisionTypes.World)
            {
                ModuleUI.GUILayerMask(CollisionModuleUI.s_Texts.collidesWith, this.m_CollidesWith);
                ModuleUI.GUIToggle(CollisionModuleUI.s_Texts.collidesWithDynamic, this.m_CollidesWithDynamic);
                if (collisionModes == CollisionModuleUI.CollisionModes.Mode3D)
                {
                    ModuleUI.GUIToggle(CollisionModuleUI.s_Texts.interiorCollisions, this.m_InteriorCollisions);
                }
                ModuleUI.GUIInt(CollisionModuleUI.s_Texts.maxCollisionShapes, this.m_MaxCollisionShapes);
                ModuleUI.GUIPopup(CollisionModuleUI.s_Texts.quality, this.m_Quality, CollisionModuleUI.s_Texts.qualitySettings);
                if (this.m_Quality.intValue > 0)
                {
                    double num3 = (double)ModuleUI.GUIFloat(CollisionModuleUI.s_Texts.voxelSize, this.m_VoxelSize);
                }
            }
            ModuleUI.GUIToggle(CollisionModuleUI.s_Texts.collisionMessages, this.m_CollisionMessages);
        }
Esempio n. 13
0
        public override void OnSceneGUI(ParticleSystem s, InitialModuleUI initial)
        {
            Event     current = Event.current;
            EventType rawType = current.type;

            if ((current.type == EventType.Ignore) && (current.rawType == EventType.MouseUp))
            {
                rawType = current.rawType;
            }
            Color color  = Handles.color;
            Color color2 = new Color(1f, 1f, 1f, 0.5f);

            Handles.color = color2;
            if (this.m_Type.intValue == 0)
            {
                for (int i = 0; i < this.m_ShownPlanes.Length; i++)
                {
                    Object objectReferenceValue = this.m_ShownPlanes[i].objectReferenceValue;
                    if (objectReferenceValue != null)
                    {
                        Transform objB = objectReferenceValue as Transform;
                        if (objB != null)
                        {
                            Vector3    position = objB.position;
                            Quaternion rotation = objB.rotation;
                            Vector3    vector2  = (Vector3)(rotation * Vector3.right);
                            Vector3    normal   = (Vector3)(rotation * Vector3.up);
                            Vector3    vector4  = (Vector3)(rotation * Vector3.forward);
                            if (object.ReferenceEquals(m_SelectedTransform, objB))
                            {
                                Tools.s_Hidden = true;
                                EditorGUI.BeginChangeCheck();
                                if (Tools.current == Tool.Move)
                                {
                                    objB.position = Handles.PositionHandle(position, rotation);
                                }
                                else if (Tools.current == Tool.Rotate)
                                {
                                    objB.rotation = Handles.RotationHandle(rotation, position);
                                }
                                if (EditorGUI.EndChangeCheck())
                                {
                                    if (this.m_PlaneVisualizationType == PlaneVizType.Solid)
                                    {
                                        GameObject plane = ParticleEffectUtils.GetPlane(i);
                                        plane.transform.position   = position;
                                        plane.transform.rotation   = rotation;
                                        plane.transform.localScale = new Vector3(this.m_ScaleGrid, this.m_ScaleGrid, this.m_ScaleGrid);
                                    }
                                    ParticleSystemEditorUtils.PerformCompleteResimulation();
                                }
                            }
                            else
                            {
                                int   keyboardControl = GUIUtility.keyboardControl;
                                float size            = HandleUtility.GetHandleSize(position) * 0.06f;
                                Handles.FreeMoveHandle(position, Quaternion.identity, size, Vector3.zero, new Handles.DrawCapFunction(Handles.RectangleCap));
                                if (((rawType == EventType.MouseDown) && (current.type == EventType.Used)) && (keyboardControl != GUIUtility.keyboardControl))
                                {
                                    m_SelectedTransform = objB;
                                    rawType             = EventType.Used;
                                }
                            }
                            if (this.m_PlaneVisualizationType == PlaneVizType.Grid)
                            {
                                Color color3 = (Color)(Handles.s_ColliderHandleColor * 0.9f);
                                if (!base.enabled)
                                {
                                    color3 = new Color(0.7f, 0.7f, 0.7f, 0.7f);
                                }
                                this.DrawGrid(position, vector2, vector4, normal, color3, i);
                            }
                            else
                            {
                                this.DrawSolidPlane(position, rotation, i);
                            }
                        }
                        else
                        {
                            Debug.LogError("Not a transform: " + objectReferenceValue.GetType());
                        }
                    }
                }
            }
            Handles.color = color;
        }
        public override void OnSceneGUI(ParticleSystem s, InitialModuleUI initial)
        {
            Event     current   = Event.current;
            EventType eventType = current.type;

            if (current.type == EventType.Ignore && current.rawType == EventType.MouseUp)
            {
                eventType = current.rawType;
            }
            Color color  = Handles.color;
            Color color2 = new Color(1f, 1f, 1f, 0.5f);

            Handles.color = color2;
            if (this.m_Type.intValue == 0)
            {
                for (int i = 0; i < this.m_ShownPlanes.Length; i++)
                {
                    UnityEngine.Object objectReferenceValue = this.m_ShownPlanes[i].objectReferenceValue;
                    if (objectReferenceValue != null)
                    {
                        Transform transform = objectReferenceValue as Transform;
                        if (transform != null)
                        {
                            Vector3    position = transform.position;
                            Quaternion rotation = transform.rotation;
                            Vector3    axis     = rotation * Vector3.right;
                            Vector3    normal   = rotation * Vector3.up;
                            Vector3    axis2    = rotation * Vector3.forward;
                            if (object.ReferenceEquals(CollisionModuleUI.s_SelectedTransform, transform))
                            {
                                Tools.s_Hidden = true;
                                EditorGUI.BeginChangeCheck();
                                if (Tools.current == Tool.Move)
                                {
                                    transform.position = Handles.PositionHandle(position, rotation);
                                }
                                else if (Tools.current == Tool.Rotate)
                                {
                                    transform.rotation = Handles.RotationHandle(rotation, position);
                                }
                                if (EditorGUI.EndChangeCheck())
                                {
                                    if (this.m_PlaneVisualizationType == CollisionModuleUI.PlaneVizType.Solid)
                                    {
                                        GameObject plane = ParticleEffectUtils.GetPlane(i);
                                        plane.transform.position   = position;
                                        plane.transform.rotation   = rotation;
                                        plane.transform.localScale = new Vector3(this.m_ScaleGrid, this.m_ScaleGrid, this.m_ScaleGrid);
                                    }
                                    ParticleSystemEditorUtils.PerformCompleteResimulation();
                                }
                            }
                            else
                            {
                                int        keyboardControl = GUIUtility.keyboardControl;
                                float      num             = HandleUtility.GetHandleSize(position) * 0.06f;
                                Vector3    arg_1EB_0       = position;
                                Quaternion arg_1EB_1       = Quaternion.identity;
                                float      arg_1EB_2       = num;
                                Vector3    arg_1EB_3       = Vector3.zero;
                                if (CollisionModuleUI.< > f__mg$cache0 == null)
                                {
                                    CollisionModuleUI.< > f__mg$cache0 = new Handles.CapFunction(Handles.RectangleHandleCap);
                                }
                                Handles.FreeMoveHandle(arg_1EB_0, arg_1EB_1, arg_1EB_2, arg_1EB_3, CollisionModuleUI.< > f__mg$cache0);
                                if (eventType == EventType.MouseDown && current.type == EventType.Used && keyboardControl != GUIUtility.keyboardControl)
                                {
                                    CollisionModuleUI.s_SelectedTransform = transform;
                                    eventType = EventType.Used;
                                }
                            }
                            if (this.m_PlaneVisualizationType == CollisionModuleUI.PlaneVizType.Grid)
                            {
                                Color color3 = Handles.s_ColliderHandleColor * 0.9f;
                                if (!base.enabled)
                                {
                                    color3 = new Color(0.7f, 0.7f, 0.7f, 0.7f);
                                }
                                this.DrawGrid(position, axis, axis2, normal, color3, i);
                            }
                            else
                            {
                                this.DrawSolidPlane(position, rotation, i);
                            }
                        }
                        else
                        {
                            Debug.LogError("Not a transform: " + objectReferenceValue.GetType());
                        }
                    }
                }
            }
            Handles.color = color;
        }
Esempio n. 15
0
        public override void OnInspectorGUI(ParticleSystem s)
        {
            if (s_Texts == null)
            {
                s_Texts = new Texts();
            }
            string[] options = new string[] { "Planes", "World" };
            EditorGUI.BeginChangeCheck();
            CollisionTypes types = (CollisionTypes)ModuleUI.GUIPopup("", this.m_Type, options, new GUILayoutOption[0]);
            bool           flag  = EditorGUI.EndChangeCheck();
            CollisionModes modes = CollisionModes.Mode3D;

            if (types == CollisionTypes.Plane)
            {
                this.DoListOfPlanesGUI();
                EditorGUI.BeginChangeCheck();
                this.m_PlaneVisualizationType = (PlaneVizType)ModuleUI.GUIPopup(s_Texts.visualization, (int)this.m_PlaneVisualizationType, this.m_PlaneVizTypeNames, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck() || flag)
                {
                    EditorPrefs.SetInt("PlaneColisionVizType", (int)this.m_PlaneVisualizationType);
                    if (this.m_PlaneVisualizationType == PlaneVizType.Solid)
                    {
                        this.SyncVisualization();
                    }
                    else
                    {
                        ParticleEffectUtils.ClearPlanes();
                    }
                }
                EditorGUI.BeginChangeCheck();
                this.m_ScaleGrid = ModuleUI.GUIFloat(s_Texts.scalePlane, this.m_ScaleGrid, "f2", new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    this.m_ScaleGrid = Mathf.Max(0f, this.m_ScaleGrid);
                    EditorPrefs.SetFloat("ScalePlaneColision", this.m_ScaleGrid);
                    this.SyncVisualization();
                }
            }
            else
            {
                ParticleEffectUtils.ClearPlanes();
                string[] textArray2 = new string[] { "3D", "2D" };
                modes = (CollisionModes)ModuleUI.GUIPopup(s_Texts.collisionMode, this.m_CollisionMode, textArray2, new GUILayoutOption[0]);
            }
            EditorGUI.BeginChangeCheck();
            s_VisualizeBounds = ModuleUI.GUIToggle(s_Texts.visualizeBounds, s_VisualizeBounds, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetBool("VisualizeBounds", s_VisualizeBounds);
            }
            ModuleUI.GUIMinMaxCurve(s_Texts.dampen, this.m_Dampen, new GUILayoutOption[0]);
            ModuleUI.GUIMinMaxCurve(s_Texts.bounce, this.m_Bounce, new GUILayoutOption[0]);
            ModuleUI.GUIMinMaxCurve(s_Texts.lifetimeLoss, this.m_LifetimeLossOnCollision, new GUILayoutOption[0]);
            ModuleUI.GUIFloat(s_Texts.minKillSpeed, this.m_MinKillSpeed, new GUILayoutOption[0]);
            ModuleUI.GUIFloat(s_Texts.maxKillSpeed, this.m_MaxKillSpeed, new GUILayoutOption[0]);
            ModuleUI.GUIFloat(s_Texts.radiusScale, this.m_RadiusScale, new GUILayoutOption[0]);
            if (types == CollisionTypes.World)
            {
                ModuleUI.GUILayerMask(s_Texts.collidesWith, this.m_CollidesWith, new GUILayoutOption[0]);
                if (modes == CollisionModes.Mode3D)
                {
                    ModuleUI.GUIToggle(s_Texts.interiorCollisions, this.m_InteriorCollisions, new GUILayoutOption[0]);
                }
                ModuleUI.GUIInt(s_Texts.maxCollisionShapes, this.m_MaxCollisionShapes, new GUILayoutOption[0]);
                ModuleUI.GUIPopup(s_Texts.quality, this.m_Quality, s_Texts.qualitySettings, new GUILayoutOption[0]);
                if (this.m_Quality.intValue == 0)
                {
                    ModuleUI.GUIToggle(s_Texts.collidesWithDynamic, this.m_CollidesWithDynamic, new GUILayoutOption[0]);
                }
                else
                {
                    ModuleUI.GUIFloat(s_Texts.voxelSize, this.m_VoxelSize, new GUILayoutOption[0]);
                }
            }
            ModuleUI.GUIToggle(s_Texts.collisionMessages, this.m_CollisionMessages, new GUILayoutOption[0]);
        }