/// <summary> /// Event handler for when the vegetables harvested stat changes /// </summary> /// <param name="s"></param> public void OnVegetablesHarvestedChange(IGameStat s) { if ((double)s.Value >= forestGardenThreshold) { EnableForestGardens(); } }
/// <summary> /// Withdraws the given reservation from this reservoir /// </summary> /// <param name="res"></param> /// <exception cref="System.ArgumentException">Thrown when an invalid reservation is passed</exception> /// <returns>True on success, false if the reservation is not fulfillable</returns> public bool WithdrawReservation(ResourceReservation res) { if (res.source != this.gameObject) { Debug.Log(res); throw new ArgumentException("Reservation not for this Reservoir"); } if (res.Released || res.Cancelled) { Debug.Log(res); throw new ArgumentException("Invalid reservation!"); } if (amount >= res.amount) { amount -= res.amount; res.Released = true; reservations.Remove(res); if (!String.IsNullOrEmpty(harvestStat)) { IGameStat stat = statManager.Stat(harvestStat); if (stat != null) { stat.Add(res.amount); } else { Debug.Log("Unable to resolve stat " + harvestStat); } } return(true); } else { return(false); } }