Exemple #1
0
        void DrawGizmos()
        {
#if UNITY_EDITOR
            if (MaskName != "")
            {
                GUIStyle stLabel = new GUIStyle(EditorStyles.whiteLabel);
                Handles.Label(GetMaskCenter(), MaskName, stLabel);
            }
#endif
            if (ShowArea)
            {
#if UNITY_EDITOR
                Gizmos.color = new Color(1f, 1f, 0, 1f);
                Camera sceneviewCamera = SceneViewDetector.GetCurrentSceneViewCamera();
                if (!sceneviewCamera)
                {
                    return;
                }

                for (int i = 0; i <= Nodes.Count - 1; i++)
                {
                    var distance = Vector3.Distance(sceneviewCamera.transform.position, transform.TransformPoint(Nodes[i].Position));

                    if (distance < 200)
                    {
                        Gizmos.color = new Color(1f, 1f, 1f, 1f);
                        if (Nodes[i].Selected)
                        {
                            Gizmos.color = new Color(0, 1f, 0f, 1f);
                        }

                        Gizmos.DrawSphere(transform.TransformPoint(Nodes[i].Position), 0.015f * distance);
                    }
                }

                if (Nodes.Count > 1)
                {
                    for (int i = 0; i <= Nodes.Count - 1; i++)
                    {
                        if (i == Nodes.Count - 1)
                        {
                            if (ClosedArea)
                            {
                                Gizmos.DrawLine(transform.TransformPoint(Nodes[0].Position), transform.TransformPoint(Nodes[i].Position));
                            }
                        }
                        else
                        {
                            Gizmos.DrawLine(transform.TransformPoint(Nodes[i].Position), transform.TransformPoint(Nodes[i + 1].Position));
                        }
                    }
                }
#endif
            }
        }
        public VegetationStudioCamera(VegetationStudioCameraType vegetationStudioCameraType)
        {
#if UNITY_EDITOR
            if (vegetationStudioCameraType == VegetationStudioCameraType.SceneView)
            {
                VegetationStudioCameraType = vegetationStudioCameraType;
                SelectedCamera             = SceneViewDetector.GetCurrentSceneViewCamera();
                SceneViewDetector.OnChangedSceneViewCameraDelegate += OnChangedSceneViewCameraDelegate;
            }
#endif
        }