// Update is called once per frame void Update() { double steamUnits = 0; GameObject[] neighbors = GetNeighbors(); foreach (GameObject obj in neighbors) { if (obj.GetComponent <Tile>().GetType() == typeof(Boiler)) { Boiler b = obj.GetComponent <Boiler>(); double avail = b.GetAvailableSteam(); if (avail <= maxSteam - steam && avail > 0) { steamUnits += avail; b.UseSteam(avail); } else if (avail > 0) { steamUnits += maxSteam - steam; b.UseSteam(maxSteam - steam); } // Debug.Log("Steam: " + steam + " / " + maxSteam); } } steam += steamUnits; kwProduced = steam * kwPerSteamUnit * generatorEfficiency; }