void AddToSalad(Vegetable v) { if (salad != null) { Debug.Log("Added vegetable to salad"); salad.AddVegetable(v); } else { Debug.Log("Something went wrong. Salad is null"); } }
void MakeSalad(Vegetable v) { //create empty game object GameObject g = new GameObject(); g.transform.SetParent(saladSlot.transform); g.transform.localPosition = Vector3.zero; salad = g.AddComponent <Salad>(); salad.AddVegetable(v); Debug.Log("Made a salad"); }
static void Main(string[] args) { Salad Salad1 = new Salad("Vitamin", new List <IBasicVegetable>()); var Vegetable1 = new FruitTomato(); var Vegetable2 = new FruitCucumber(); var Vegetable3 = new VegetativePekingCabbage(); var Vegetable4 = new VegetativeCabbage(); Salad1.AddVegetable(Vegetable1); Salad1.AddVegetable(Vegetable2); Salad1.AddVegetable(Vegetable3); Salad1.AddVegetable(Vegetable4); Salad1.DeleteVegetable(Vegetable4); Salad1.AddVegetable(Vegetable4); int MinSearchByCaloricity = 20; int MaxSearchByCaloricity = 100; Print(Salad1, MinSearchByCaloricity, MaxSearchByCaloricity); }