private void Awake() { _Instance = this; wayPoints.Clear(); WayPoints [] points = GetComponentsInChildren <WayPoints>(); for (int i = 0; i < points.Length; i++) { WayPoint wp = new WayPoint(); wp.pos = points[i].transform.position; wp.size = 10; wp.link = new Dictionary <int, WayLength>(); for (int j = 0; j < points[i].Link.Length; j++) { int jIndex = int.Parse(points[i].Link[j].name); WayLength wayl = new WayLength(); wayl.length = Vector3.Distance(points[i].Link[j].transform.position, points[i].transform.position); wayl.mode = 0; wp.link.Add(jIndex, wayl); } wayPoints.Add(wp); } }
private void OnDestroy() { _Instance = null; }