//给每个网格的WeightValue赋值 IEnumerator SetAllValue() { yield return(new WaitForSeconds(0)); for (int i = 2; i < navMapManager.person.Count; i++) { if (unit != null) { if (unit.Equals(navMapManager.person[2])) { heroWeight.AddWeightRange(this.gameObject); heroWeight.SetWeightValueOne(); } if (unit.Equals(navMapManager.person[3])) { heroWeight.AddWeightRange(this.gameObject); heroWeight.SetWeightValueTwo(); } if (unit.Equals(navMapManager.person[4])) { heroWeight.AddWeightRange(this.gameObject); heroWeight.SetWeightValueThree(); } } } }