Пример #1
0
        static void DrawConeWireframe(float radius, float height, HandleDirections handleDirections)
        {
            var rangeCenter = Vector3.forward * height;

            if (handleDirections.HasFlag(HandleDirections.Up))
            {
                var rangeUp = rangeCenter + Vector3.up * radius;
                Handles.DrawLine(Vector3.zero, rangeUp);
            }

            if (handleDirections.HasFlag(HandleDirections.Down))
            {
                var rangeDown = rangeCenter - Vector3.up * radius;
                Handles.DrawLine(Vector3.zero, rangeDown);
            }

            if (handleDirections.HasFlag(HandleDirections.Right))
            {
                var rangeRight = rangeCenter + Vector3.right * radius;
                Handles.DrawLine(Vector3.zero, rangeRight);
            }

            if (handleDirections.HasFlag(HandleDirections.Left))
            {
                var rangeLeft = rangeCenter - Vector3.right * radius;
                Handles.DrawLine(Vector3.zero, rangeLeft);
            }

            //Draw Circle
            Handles.DrawWireDisc(rangeCenter, Vector3.forward, radius);
        }
Пример #2
0
 static float DrawConeHandles(Vector3 position, float angle, float range, HandleDirections handleDirections, string controlName)
 {
     if (handleDirections.HasFlag(HandleDirections.Left))
     {
         angle = SizeSliderSpotAngle(position, Vector3.forward, -Vector3.right, range, angle, controlName);
     }
     if (handleDirections.HasFlag(HandleDirections.Up))
     {
         angle = SizeSliderSpotAngle(position, Vector3.forward, Vector3.up, range, angle, controlName);
     }
     if (handleDirections.HasFlag(HandleDirections.Right))
     {
         angle = SizeSliderSpotAngle(position, Vector3.forward, Vector3.right, range, angle, controlName);
     }
     if (handleDirections.HasFlag(HandleDirections.Down))
     {
         angle = SizeSliderSpotAngle(position, Vector3.forward, -Vector3.up, range, angle, controlName);
     }
     return(angle);
 }