private void SetBars() { foreach (KeyValuePair <ShortCutButton, ButtonData> pair in buttons) { Bar healthBar = pair.Value.healthBar; switch (pair.Key) { case ShortCutButton.Market: continue; case ShortCutButton.Building: buildingHealth.SetBuildingHealthBar(healthBar); break; case ShortCutButton.Foundation: buildingHealth.SetFoundationHealthBar(healthBar); break; case ShortCutButton.Soil: buildingHealth.SetSoilHealthBar(healthBar); break; default: throw new ArgumentOutOfRangeException(); } } }
private void SetBars(AbstractBuildingTile tile) { bool active = tile != null; buildingHealthBar.CachedGameObject.SetActive(active); foundationHealthBar.CachedGameObject.SetActive(active); soilHealthBar.CachedGameObject.SetActive(active); if (!active) { return; } BuildingHealth health = tile.Building.GetComponent <BuildingHealth>(); health.SetBuildingHealthBar(buildingHealthBar); health.SetFoundationHealthBar(foundationHealthBar); health.SetSoilHealthBar(soilHealthBar); }