/// <summary> /// Set Amount of Fodder /// </summary> /// <param name="NewValue"></param> public void Set(double NewValue) { this._Amount = NewValue; if (FoodStoreChanged != null) { FoodStoreChanged.Invoke(this, new EventArgs()); } }
/// <summary> /// Add Food /// </summary> /// <param name="AddAmount">Amount to add to resource</param> /// <param name="ActivityName">Name of activity requesting resource</param> /// <param name="UserName">Name of individual requesting resource</param> public void Add(double AddAmount, string ActivityName, string UserName) { this._Amount = this._Amount + AddAmount; if (FoodStoreChanged != null) { FoodStoreChanged.Invoke(this, new EventArgs()); } }
/// <summary> /// Remove Food /// </summary> /// <param name="RemoveAmount">nb. This is a positive value not a negative value.</param> /// <param name="ActivityName">Name of activity requesting resource</param> /// <param name="UserName">Name of individual requesting resource</param> public void Remove(double RemoveAmount, string ActivityName, string UserName) { if (this._Amount - RemoveAmount < 0) { string message = "Tried to remove more " + this.Name + " than exists." + Environment.NewLine + "Current Amount: " + this._Amount + Environment.NewLine + "Tried to Remove: " + RemoveAmount; Summary.WriteWarning(this, message); this._Amount = 0; } else { this._Amount = this._Amount - RemoveAmount; } if (FoodStoreChanged != null) { FoodStoreChanged.Invoke(this, new EventArgs()); } }