Пример #1
0
        public static Vector3 GetMousePosWithMoveSpace(Ray ray, Vector2 guiMousePos, MovingSpace pathSpace, float planeHeight)
        {
            float dst = 0;

            if (pathSpace == MovingSpace.XY)
            {
                dst = (planeHeight - ray.origin.z) / ray.direction.z;
                return(ray.origin + ray.direction * dst);
            }
            dst = (planeHeight - ray.origin.y) / ray.direction.y;
            return(ray.origin + ray.direction * dst);
        }
Пример #2
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            EditorGUILayout.HelpBox(helpInfo, MessageType.Info);

            DrawInspectorForTransportWithTransformAndIsClose();

            if (!transportWithTransformInEditor)
            {
                smoothLine.resolation = EditorGUILayout.IntSlider("Resolation", smoothLine.resolation, 1, 40);
                movingSpace           = (MovingSpace)EditorGUILayout.Popup("Moving Space", (int)movingSpace, MovingSpaceName);

                smoothLine.useSnap = EditorGUILayout.Toggle("Use Snap", smoothLine.useSnap);
                if (smoothLine.useSnap)
                {
                    smoothLine.snapValue = EditorGUILayout.FloatField("Snap Value", smoothLine.snapValue);
                }

                openVisualSettingPanel = EditorGUILayout.Foldout(openVisualSettingPanel, "Visual Settings");
                if (openVisualSettingPanel)
                {
                    smoothLine.visualSetting.nodeRadius          = EditorGUILayout.FloatField("Node Radius", smoothLine.visualSetting.nodeRadius);
                    smoothLine.visualSetting.anchorRadius        = EditorGUILayout.FloatField("Anchor Radius", smoothLine.visualSetting.anchorRadius);
                    smoothLine.visualSetting.showPathNotSelected = EditorGUILayout.Toggle("Show Path Not Selected", smoothLine.visualSetting.showPathNotSelected);
                }

                DrawInspectorForRadius();

                if (GUILayout.Button("Reset"))
                {
                    Undo.RecordObject(smoothLine, "Reset Smooth Line");
                    smoothLine.Reset(movingSpace);
                    SceneView.RepaintAll();
                }
            }

            if (isDoubleClickNode && smoothLine.transform.hasChanged)
            {
                smoothLine.UpdateNode(lastSelectedNodeIndex, smoothLine.transform.position);
                GUI.changed = true;
            }

            if (GUI.changed)
            {
                smoothLine.ConvertToSmoothCurve();
                SceneView.RepaintAll();
            }
        }
Пример #3
0
 void ChangeSpace()
 {
     movingSpace = (MovingSpace)(1 - (int)movingSpace);
 }