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);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
        // public Vector2 GetPosition(float time)
        // {

        // }

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

        // }

        public void DrawGizmos()
        {
            GizmosHelper.DrawCurve(m_points, (PathPoint point) => point.position);
        }