Esempio n. 1
0
        public void Awake()
        {
            _randomWaypoint            = GetComponent <RandomWaypoint>();
            _lineRenderer              = GetComponent <LineRenderer>();
            _lineRenderer.sortingOrder = 10;

            Vector3[] points = _randomWaypoint.GetEllipsePoints();
            _lineRenderer.SetVertexCount(points.Length);
            for (int i = 0; i < points.Length; i++)
            {
                _lineRenderer.SetPosition(i, points[i]);
            }
        }
Esempio n. 2
0
        public Vector3 CapturePosition(WaypointsMover mover, int waypointIndex)
        {
            Transform      waypoint       = Waypoints[waypointIndex];
            RandomWaypoint randomWaypoint = waypoint.GetComponent <RandomWaypoint>();
            Vector3        position       = randomWaypoint == null
                ? waypoint.position
                : randomWaypoint.GenerateRandomPoint();

            if (!_capturedPositions.ContainsKey(mover))
            {
                _capturedPositions[mover] = new Dictionary <int, Vector3>();
            }

            _capturedPositions[mover][waypointIndex] = position;
            return(position);
        }