Exemple #1
0
        /// <summary>Adds a target to be constantly evidenced.</summary>
        public static void AddTarget(UnityEngine.Object target, Color color, bool drawOnlyOnce = false)
        {
            CheckInit();
            HOGizmoData gd = new HOGizmoData {
                type         = GizmoType.TargetBounds,
                target       = target,
                color        = color,
                drawOnlyOnce = drawOnlyOnce
            };

            _GizmosData.Add(gd);
        }
Exemple #2
0
        /// <summary>Adds a line to be constantly drawn as a gizmo.</summary>
        public static void AddLine(Vector3 from, Vector3 to, Color color, bool drawOnlyOnce = false)
        {
            CheckInit();
            HOGizmoData gd = new HOGizmoData {
                type         = GizmoType.Line,
                position     = from,
                endPosition  = to,
                color        = color,
                drawOnlyOnce = drawOnlyOnce
            };

            _GizmosData.Add(gd);
        }
Exemple #3
0
        /// <summary>Adds a point to be constantly shown as a gizmo.</summary>
        public static void AddPoint(Vector3 position, Color color, float radius, bool drawOnlyOnce = false)
        {
            CheckInit();
            HOGizmoData gd = new HOGizmoData {
                type         = GizmoType.Point,
                position     = position,
                color        = color,
                radius       = radius,
                drawOnlyOnce = drawOnlyOnce
            };

            _GizmosData.Add(gd);
        }
Exemple #4
0
        void OnDrawGizmos()
        {
            for (int i = _GizmosData.Count - 1; i > -1; --i)
            {
                HOGizmoData gd = _GizmosData[i];
                Gizmos.color = gd.color;
                switch (gd.type)
                {
                case GizmoType.Point:
                    Gizmos.DrawWireSphere(gd.position, gd.radius);
                    break;

                case GizmoType.TargetBounds:
                    Bounds bounds    = new Bounds();
                    bool   boundsSet = true;
                    switch (gd.targetType)
                    {
                    case TargetType.Collider:
                        bounds = ((Collider)gd.target).bounds;
                        break;

                    case TargetType.Mesh:
                        bounds = ((Mesh)gd.target).bounds;
                        break;

                    case TargetType.Renderer:
                        bounds = ((Renderer)gd.target).bounds;
                        break;

                    default:
                        boundsSet = false;
                        break;
                    }
                    if (boundsSet)
                    {
                        Gizmos.DrawWireCube(bounds.center, bounds.size);
                    }
                    break;

                case GizmoType.Line:
                    Gizmos.DrawLine(gd.position, gd.endPosition);
                    break;
                }
                if (gd.drawOnlyOnce)
                {
                    _GizmosData.RemoveAt(i);
                }
            }
        }
 /// <summary>Adds a line to be constantly drawn as a gizmo.</summary>
 public static void AddLine(Vector3 from, Vector3 to, Color color, bool drawOnlyOnce = false)
 {
     CheckInit();
     HOGizmoData gd = new HOGizmoData {
         type = GizmoType.Line,
         position = from,
         endPosition = to,
         color = color,
         drawOnlyOnce = drawOnlyOnce
     };
     _GizmosData.Add(gd);
 }
 /// <summary>Adds a target to be constantly evidenced.</summary>
 public static void AddTarget(UnityEngine.Object target, Color color, bool drawOnlyOnce = false)
 {
     CheckInit();
     HOGizmoData gd = new HOGizmoData {
         type = GizmoType.TargetBounds,
         target = target,
         color = color,
         drawOnlyOnce = drawOnlyOnce
     };
     _GizmosData.Add(gd);
 }
 /// <summary>Adds a point to be constantly shown as a gizmo.</summary>
 public static void AddPoint(Vector3 position, Color color, float radius, bool drawOnlyOnce = false)
 {
     CheckInit();
     HOGizmoData gd = new HOGizmoData {
         type = GizmoType.Point,
         position = position,
         color = color,
         radius = radius,
         drawOnlyOnce = drawOnlyOnce
     };
     _GizmosData.Add(gd);
 }