/// <summary> /// Calls the code to add hydration to all refugees within a set range. /// </summary> private void FireRestoreHydration() { float distance; for (int i = 0; i < housingManager.GetHousesCount(); ++i) { distance = Vector3.Distance(refugeeManager.GetRefugeeAtIndex(i).cachedTransform.position, cachedTransform.position); if (distance < hydrationRange) { //refugeeManager.GetRefugeeAtIndex(i).SetHasHydration(true); //refugeeManager.GetRefugeeAtIndex(i).GetHydration().AddCurrStat(hydrationToRestore); } } }
/// <summary> /// Waits for the construction to finish. /// </summary> /// <returns></returns> protected override IEnumerator BuildingConstructionBegin() { yield return(new WaitForTicks(constructionTime)); HousingManager housingManager = HousingManager.GetInstance(); float distance; for (int i = 0; i < housingManager.GetHousesCount(); ++i) { distance = Vector3.Distance(housingManager.GetHouseAtIndex(i).cachedTransform.position, cachedTransform.position); if (distance < maxRadius) { housingManager.GetHouseAtIndex(i).AddWaterSource(health); } } }