public string Fill(IngredientNames ingredient, Containers From) { string OutputVar; StringBuilder BuildString = new StringBuilder(); IngredientNames Nothing = IngredientNames.Nothing; BuildString.Append(ingredient.ToString() + " has been added to " + this.Name.ToString() + " from " + From.ToString()); if (this.Contains1 == Nothing) { this.Contains1 = ingredient; if (this.Contains2 == null) { this.IsFull = true; } } else if (this.Contains2 == Nothing && this.Contains2 != null) { this.Contains2 = ingredient; if (this.Contains3 != Nothing) { this.IsFull = true; } } else if (this.Contains3 == Nothing && this.Contains3 != null) { Contains3 = ingredient; this.IsFull = true; } OutputVar = BuildString.ToString(); BuildString.Clear(); return(OutputVar); }
public string Fill(IngredientNames ingredient) { StringBuilder BuildString = new StringBuilder(); IngredientNames Nothing = IngredientNames.Nothing; string Value, OutputVar; Value = CheckName(); if (this.InHand == true) { if (ingredient != IngredientNames.Nothing) { if (this.IsFull == false) { BuildString.Append(Value + " has been filled with " + ingredient.ToString() + "\n"); if (Contains1 == Nothing) { Contains1 = ingredient; if (Contains2 == null) { this.IsFull = true; } } else if (Contains2 == Nothing && Contains2 != null) { Contains2 = ingredient; if (Contains3 != Nothing) { this.IsFull = true; } } else if (Contains3 == Nothing && Contains3 != null) { Contains3 = ingredient; this.IsFull = true; } } else { BuildString.Append(Value + " is already full, empty first!" + "\n"); } } else { BuildString.Append("You tried to fill the " + Value + " with fresh air alongside it's current contents. \n"); BuildString.Append("You gave up after a while..."); } } else { BuildString.Append("Might want to pick up this item before you try fill this item."); } OutputVar = BuildString.ToString(); BuildString.Clear(); return(OutputVar); }