public void DrawCurveGizmos(float pointRadius, float lastPointArrivalRadius, bool loop, int highlightedIndex)
        {
            var points = FindPathPoints();

            if (points.Length <= 0)
            {
                return;
            }

            var pointPositions = FindPathPoints().Select((PathPoint point) => (Vector2)point.transform.position);

            Gizmos.color = Color.red;
            GizmosHelper.DrawCurve(pointPositions, loop: loop);

            var pointIndex = 0;

            foreach (var point in pointPositions)
            {
                var isCurrent = pointIndex == highlightedIndex;
                Gizmos.color = isCurrent ? Color.blue : Color.red;
                GizmosHelper.DrawCircle(point, pointRadius);
                pointIndex++;
            }

            if (lastPointArrivalRadius > 0.0f)
            {
                Gizmos.color = Color.green;
                GizmosHelper.DrawCircle(points.Last().transform.position, lastPointArrivalRadius);
            }
        }
Пример #2
0
        public static void DrawCurve <PointType>(IEnumerable <PointType> points, System.Func <PointType, Vector2> getPosition, float pointSize = -1.0f, bool wireframePoint = false)
        {
            Vector2?prevPosition = null;

            foreach (var point in points)
            {
                var position = getPosition(point);

                if (prevPosition.HasValue)
                {
                    Gizmos.DrawLine(prevPosition.Value, position);
                }

                if (pointSize > 0.0f)
                {
                    if (wireframePoint)
                    {
                        GizmosHelper.DrawCircle(position, pointSize);
                    }
                    else
                    {
                        Gizmos.DrawSphere(position, pointSize);
                    }
                }

                prevPosition = position;
            }
        }
        private void OnDrawGizmos()
        {
            if (m_sensor != null)
            {
                return;
            }

            Gizmos.color = Color.red;
            GizmosHelper.DrawCircle(transform.position, m_sensorRange);
        }
 private void OnDrawGizmos()
 {
     if (m_ghostPlayer)
     {
         Gizmos.color = Color.green;
         GizmosHelper.DrawCircle(m_ghostPlayer.position, m_minOffset);
         Gizmos.color = Color.red;
         GizmosHelper.DrawCircle(m_ghostPlayer.position, m_maxOffset);
     }
 }
Пример #5
0
        private void OnDrawGizmos()
        {
            if (!m_drawGizmos)
            {
                return;
            }

            Gizmos.color = m_color;
            GizmosHelper.DrawCircle(transform.position, m_radius);
        }
Пример #6
0
 private void OnDrawGizmos()
 {
     if (controller != null)
     {
         Gizmos.color = Color.red;
         var oldMatrix = Gizmos.matrix;
         Gizmos.matrix = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale);
         GizmosHelper.DrawWireRectangle(Vector3.zero, controller.portalSize);
         Gizmos.matrix = oldMatrix;
     }
 }
Пример #7
0
        protected override void DrawGizmos()
        {
            base.DrawGizmos();

            if (!Application.isPlaying)
            {
                Gizmos.color = Color.green;
                var initialAngle = Vector2.SignedAngle(Vector2.up, transform.up);
                var points       = CalculateApproximation(position);

                GizmosHelper.DrawCurve(points);
            }
        }
        private void OnDrawGizmos()
        {
            if (m_gridTransform != null)
            {
                var gridCenter = m_gridCenter;
                var gridRange  = m_gridRange;

                Gizmos.color = Color.red;
                Gizmos.DrawWireCube(gridCenter, gridRange);

                Gizmos.color = Color.red;
                GizmosHelper.DrawVector(gridCenter, Vector3.right, 0.1f);
                Gizmos.color = Color.green;
                GizmosHelper.DrawVector(gridCenter, Vector3.up, 0.1f);
                Gizmos.color = Color.blue;
                GizmosHelper.DrawVector(gridCenter, Vector3.forward, 0.1f);
            }

            if (m_drawPointGizmos && m_gridValuePoints != null)
            {
                foreach (var point in m_gridControlPoints)
                {
                    if (!point.valid)
                    {
                        continue;
                    }

                    Gizmos.color = Color.green;
                    Gizmos.DrawSphere(transform.TransformPoint(point.position), 0.02f);
                }

                foreach (var point in m_gridValuePoints)
                {
                    if (m_useIsoThresholdForColor)
                    {
                        Gizmos.color = point.active ? Color.white : Color.black;
                    }
                    else
                    {
                        Gizmos.color = Color.Lerp(Color.black, Color.white, point.value);
                    }

                    if (!point.debugDataValid)
                    {
                        Gizmos.color = Color.magenta;
                    }

                    Gizmos.DrawSphere(transform.TransformPoint(point.position), 0.02f);
                }
            }
        }
Пример #9
0
        protected virtual void DrawGizmos()
        {
            if (m_behaviourIndex < 0)
            {
                return;
            }

            var colorIndex = m_behaviourIndex % m_debugColors.Length;

            Gizmos.color = m_debugColors[colorIndex];

            GizmosHelper.DrawVector(transform.position, m_right * m_lastAppliedForceComponents.x);
            GizmosHelper.DrawVector(transform.position, m_forward * m_lastAppliedForceComponents.y);
        }
        protected override void DrawGizmos()
        {
            base.DrawGizmos();

            if (m_target == null)
            {
                return;
            }

            if (m_slowNearTarget)
            {
                Gizmos.color = Color.green;
                GizmosHelper.DrawCircle(m_target.position, m_brakingRadius);
                GizmosHelper.DrawCircle(m_target.position, m_epsilonRadius);
            }
        }
        protected override void DrawGizmos()
        {
            base.DrawGizmos();

            Gizmos.color = Color.magenta;
            GizmosHelper.DrawCircle(position, m_minDistance);
            GizmosHelper.DrawCircle(position, m_maxDistance);

            Gizmos.color = Color.black;
            GizmosHelper.DrawCircle(position, m_hullRadius);
            GizmosHelper.DrawCircle(position, m_hullRadius + m_safetyDistance);

            if (m_currentTargetData.HasValue)
            {
                var data = m_currentTargetData.Value;

                Gizmos.color = Color.white;
                GizmosHelper.DrawVector(position, data.direction);

                Gizmos.color = Color.blue;
                Gizmos.DrawLine(position, data.position);
            }
        }
Пример #12
0
        public static void DrawCurve(IEnumerable <Vector2> points, float pointSize = -1.0f, bool wireframePoint = false, bool loop = false)
        {
            Vector2?firstPoint = null;
            Vector2?prevPoint  = null;

            foreach (var point in points)
            {
                if (!firstPoint.HasValue)
                {
                    firstPoint = point;
                }

                if (prevPoint.HasValue)
                {
                    Gizmos.DrawLine(prevPoint.Value, point);
                }

                if (pointSize > 0.0f)
                {
                    if (wireframePoint)
                    {
                        GizmosHelper.DrawCircle(point, pointSize);
                    }
                    else
                    {
                        Gizmos.DrawSphere(point, pointSize);
                    }
                }

                prevPoint = point;
            }

            if (loop && prevPoint.HasValue && firstPoint.HasValue)
            {
                Gizmos.DrawLine(prevPoint.Value, firstPoint.Value);
            }
        }
 private void OnDrawGizmos()
 {
     Gizmos.color = Color.red;
     GizmosHelper.DrawCircle(transform.position, m_radius);
 }
Пример #14
0
        // public Vector2 GetPosition(float time)
        // {

        // }

        // public Vector2 GetTangent(float time)
        // {

        // }

        public void DrawGizmos()
        {
            GizmosHelper.DrawCurve(m_points, (PathPoint point) => point.position);
        }
Пример #15
0
 private void OnDrawGizmos()
 {
     Gizmos.color = Color.blue;
     GizmosHelper.DrawEllipse(transform.position, m_radii, 64);
 }
 private void OnDrawGizmos()
 {
     Gizmos.color = m_gizmoColor;
     GizmosHelper.DrawCircle(m_center, m_radius, 64);
 }