public float Sludgeworks_RegenerationValue; // 10 /// <summary> /// Metoda wywoływana co sekundę /// </summary> void GenerateShit() { if (BuildingType == BuildingType.Sludgeworks) { // Jeżeli jest to oczyszczalnia to nie generuje zysków if (Sludgeworks_CurrentAvailableShits < Sludgeworks_MaximumShits) { Sludgeworks_CurrentAvailableShits += Sludgeworks_RegenerationValue * Time.deltaTime; } } else { // Jeżeli wartość nie przekroczyła maksymalnej dopuszczalnej to zwiększa licznik if (CurrentShits < MaximumShits) { CurrentShits += HumansInBuilding; // Aktualizacja wskaźnika zapełnienia - jeżeli jest on wyświetlony dla tego budynku if (Helper.GetGUIManager().BuildingMode_BuildingProgressBar.activeInHierarchy) { BuildingProgressBar progressBarScript = Helper.GetGUIManager().BuildingMode_BuildingProgressBar.GetComponent <BuildingProgressBar>(); if (progressBarScript != null) { if (progressBarScript.GetCurrentlyFollowingBuilding() == gameObject) { progressBarScript.SetValue(this); } } } } } }
/// <summary> /// Metoda powoduje 'zabranie' przez skrypt oczyszczalni G z danego budynku /// </summary> /// <returns></returns> public BigInteger TakeShit(float maximum = 0) { BigInteger toReturn = CurrentValue(); BigInteger max = new BigInteger(maximum.ToString("0")); if (maximum != 0 && toReturn > max) { toReturn = max; _currentShits -= max; } else { _currentShits = 0; } // Aktualizacja wskaźnika zapełnienia - jeżeli jest on wyświetlony dla tego budynku if (Helper.GetGUIManager().BuildingMode_BuildingProgressBar.activeInHierarchy) { BuildingProgressBar progressBarScript = Helper.GetGUIManager().BuildingMode_BuildingProgressBar.GetComponent <BuildingProgressBar>(); if (progressBarScript != null) { if (progressBarScript.GetCurrentlyFollowingBuilding() == gameObject) { progressBarScript.SetValue(this); } } } return(toReturn); }