Beispiel #1
0
        //editor visualization
        void OnDrawGizmos()
        {
            if (waypoints.Length <= 0)
            {
                return;
            }

            //get positions
            Vector3[] wpPositions = GetPathPoints();

            //assign path ends color
            Vector3 start = wpPositions[0];
            Vector3 end   = wpPositions[wpPositions.Length - 1];

            Gizmos.color = color1;
            Gizmos.DrawWireCube(start, size * GetHandleSize(start) * 1.5f);
            Gizmos.DrawWireCube(end, size * GetHandleSize(end) * 1.5f);

            //assign line and waypoints color
            Gizmos.color = color2;
            for (int i = 1; i < wpPositions.Length - 1; i++)
            {
                Gizmos.DrawWireSphere(wpPositions[i], radius * GetHandleSize(wpPositions[i]));
            }

            //draw linear or curved lines with the same color
            if (drawCurved && wpPositions.Length >= 2)
            {
                WaypointManager.DrawCurved(wpPositions);
            }
            else
            {
                WaypointManager.DrawStraight(wpPositions);
            }
        }
Beispiel #2
0
        //editor visualization
        void OnDrawGizmos()
        {
            if (bPoints.Count <= 0)
            {
                return;
            }

            //assign path ends color
            Vector3 start = bPoints[0].wp.position;
            Vector3 end   = bPoints[bPoints.Count - 1].wp.position;

            Gizmos.color = color1;
            Gizmos.DrawWireCube(start, size * GetHandleSize(start) * 1.5f);
            Gizmos.DrawWireCube(end, size * GetHandleSize(end) * 1.5f);

            //assign line and waypoints color
            Gizmos.color = color2;
            for (int i = 1; i < bPoints.Count - 1; i++)
            {
                Gizmos.DrawWireSphere(bPoints[i].wp.position, radius * GetHandleSize(bPoints[i].wp.position));
            }

            //draw linear or curved lines with the same color
            if (drawCurved && bPoints.Count >= 2)
            {
                WaypointManager.DrawCurved(pathPoints);
            }
            else
            {
                WaypointManager.DrawStraight(pathPoints);
            }
        }