Example #1
0
        private void OnDrawGizmos()
        {
            var normalColor       = new Color(0.26f, 0.49f, 1f);
            var pickedPointColor  = new Color(1f, 0.36f, 0.23f);
            var selectedPathColor = new Color(0.22f, 1f, 0.29f);

            var isSelectedPath = Selection.gameObjects.Any(o => o == gameObject || o.transform.IsChildOf(transform));

            var lineColor = isSelectedPath ? selectedPathColor : normalColor;

            if (_Points == null)
            {
                return;
            }

            var hasMoreThanOnePoint = _Points.Count > 1;

            for (var index = 0; index < _Points.Count; index++)
            {
                var point           = _Points[index];
                var pointPos        = point.Position;
                var isSelectedPoint = Selection.gameObjects.Contains(point.gameObject);
                // Draw Line
                if (index < _Points.Count - 1 && hasMoreThanOnePoint)
                {
                    var nextPoint = _Points[index + 1].Position;
#if USING_SHAPES
                    Draw.Line(pointPos, nextPoint, lineColor);
#endif
                }
                // Draw Sphere
                var pointColor      = isSelectedPoint ? pickedPointColor : normalColor;
                var firstPointColor = Colors.Aqua;
#if USING_SHAPES
                Draw.Sphere(pointPos, .1f, index == 0 ? firstPointColor : pointColor);
#endif
            }

            // Draw test pos
            var pos = GetWorldPosAtPathPos(_testPos, out var lookDirection);
#if USING_SHAPES
            Draw.Point(pos, color: Colors.LightYellow);
            Draw.ArrowRay(pos, lookDirection, Colors.CadetBlue);
#endif
        }