/// <summary> /// Set Amount of Food /// </summary> /// <param name="NewValue"></param> public void Set(double NewValue) { this.amount = NewValue; if (FodderChanged != null) { FodderChanged.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 (FodderChanged != null) { FodderChanged.Invoke(this, new EventArgs()); } }
/// <summary> /// /// </summary> /// <param name="RemoveAmount"></param> /// <param name="ActivityName"></param> /// <param name="UserName"></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 (FodderChanged != null) { FodderChanged.Invoke(this, new EventArgs()); } }