private void UpdateTarget(float freeAcceleration) { if (((Vector2)transform.position - _CurrentTarget).magnitude < 0.01f) { _OldTarget = _CurrentTarget; _PointIdx = _CurrentLane.GetNextTarget(_PointIdx, ref _CurrentTarget); if (_PointIdx == -1) { while (!GetNextLane() && !_Destroy) { List <Lane> newPath = Network.instance.CalculatePath(_Path[_PathIdx]._Nodes[0], _Path[_Path.Count - 1]._Nodes[1]); if (newPath == null) { Destroy(gameObject); break; } else { _Path = newPath; } } } UpdateRotation(); } }