Beispiel #1
0
        private void DrawHandles()
        {
            Color color = group.color;

            color.a = 1f;

            // Centroid label and mover
            HandlesHelpers.VisibleLabel(
                group.Centroid + Vector3.up * group.height / 2f,
                100f,
                group.name,
                new GUIStyle()
            {
                normal = new GUIStyleState()
                {
                    textColor = color
                },
                fontSize  = 14,
                fontStyle = FontStyle.Bold,
                alignment = TextAnchor.MiddleCenter
            }
                );

            Vector3 delta = HandlesHelpers.VisiblePositionHandle(group.Centroid, Config.HANDLES_DISTANCE * 2f);

            if ((delta - group.Centroid) != Vector3.zero)
            {
                group.Translate(delta - group.Centroid);
            }

            // Segments
            GUIStyle segmentLabelStyle = new GUIStyle()
            {
                normal = new GUIStyleState()
                {
                    textColor = color
                },
                alignment = TextAnchor.MiddleCenter
            };

            for (int i = 0; i < group.segments.Count; i++)
            {
                if (group.segments.Count > 1)
                {
                    HandlesHelpers.VisibleLabel(
                        group.segments[i].Midpoint + Vector3.up * group.height / 2f,
                        Config.HANDLES_DISTANCE,
                        group.segments[i].name,
                        segmentLabelStyle
                        );
                }

                group.segments[i].start = HandlesHelpers.VisiblePositionHandle(group.segments[i].start, Config.HANDLES_DISTANCE);

                if (i == group.segments.Count - 1 && !group.isClosed)
                {
                    group.segments[i].end = HandlesHelpers.VisiblePositionHandle(group.segments[i].end, Config.HANDLES_DISTANCE);
                }
            }
        }
 /// <summary>
 /// Unity3D OnSceneGUI event
 /// </summary>
 private void OnSceneGUI()
 {
     HandlesHelpers.VisibleLabel(
         zone.transform.position,
         100f,
         zone.name,
         EditorToolkit.ZoneLabelStyle(zone.color)
         );
 }