public IEnumerable <float> IntermediateDistances() { float sum = 0f; foreach (VillageCtrl neighbor in home.neighbors) { sum += Vector2.Distance(home.GetPosition(), neighbor.GetPosition()); yield return(sum); } }
/// <summary> /// We're just checking to make sure that a given village doesn't /// sit right on top of another one. /// </summary> public bool NoOverlaps(VillageCtrl village) { List <VillageCtrl> neighbors = worldMap.GetNeighbors(village.GetPosition()); foreach (VillageCtrl neighbor in neighbors) { if (village.GetRect().Overlaps(neighbor.GetRect())) { return(false); } } return(true); }