Beispiel #1
0
 static void OnSceneGUI(SceneView sceneView)
 {
     if (MapManager.current != null)
     {
         SceneViewHelper.DrawSceneMap(MapManager.current);
     }
     SceneViewHelper.ProcessEvent("MapEditor/Hidden/Scene");
 }
Beispiel #2
0
        private void OnDrawGizmosSelected()
        {
            if (createOutline && outlinePath != null && outlinePath.isValid)
            {
                Handles.color = Color.red;
                CompareFunction oldZtest = Handles.zTest;
                Handles.zTest = CompareFunction.Always;

                Vector2 prev = outlinePath[0];
                for (int i = 1; i < outlinePath.waypoints.Count; i++)
                {
                    if (SceneViewHelper.IsPointVisible(outlinePath[i]))
                    {
                        Handles.DrawLine(prev, outlinePath[i]);
                        Handles.DrawSolidDisc(outlinePath[i], Vector3.forward, 0.2f);
                    }
                    prev = outlinePath[i];
                }
                Handles.DrawSolidDisc(outlinePath[0], Vector3.forward, 0.2f);

                Handles.zTest = oldZtest;
            }

            if (forestSlotObjects.Count == 0 || outlineSlotObjects.Count == 0)
            {
                foreach (var slotData in slotDatas)
                {
                    Vector2 position = slotData.position;
                    float   radius   = slotData.scale.x;

                    Vector2 rectSize = Vector2.one * radius * 2;
                    if (!SceneViewHelper.IsRectVisible(new Rect(position - rectSize * 0.5f, rectSize)))
                    {
                        continue;
                    }

                    if (!slotData.isSwitchableColliderEnabled && forestSlotObjects.Count == 0)
                    {
                        Handles.color = new Color32(34, 139, 34, 40);
                        Handles.DrawSolidDisc(position, Vector3.forward, radius);
                    }
                    else if (slotData.isSwitchableColliderEnabled && outlineSlotObjects.Count == 0)
                    {
                        Handles.color = new Color32(142, 64, 42, 40);
                        Handles.DrawSolidDisc(position, Vector3.forward, radius);
                    }
                }
            }
        }