/// <summary> /// Populates the subshelves of this Shelf with random values. /// </summary> private void PopulateSubshelves() { //for loop loops through a number I give it, and it runs the stuff inside i amount of times for (int i = 0; i < subshelfAmount; i++) { Subshelf subshelf = new Subshelf() { subshelfItem = new OrderItem( OrderItemProcessor.GetRandomNoun(), $"{ShelfID}.{i + 1}", ui.GetRandomItemSpriteSybol(), Random.ColorHSV()), currentItemCount = Random.Range(1, 31) }; subshelves.Add(subshelf); } }
//private void Start() //{ // cartOrders = PopulateCartOrders(); //} /// <summary> /// Populates a List of Order Items for the Order Picker to pick. /// </summary> public List <OrderItem> PopulateCartOrders() { List <OrderItem> output = new List <OrderItem>(); cartOrders.Clear(); //Get the Order Items in the warehouse List <Shelf> shelves = FindObjectsOfType <Shelf>().ToList(); //We need a random assortment of items from the warehouse. for (int i = 0; i < amountOfItemsOnCart; i++) { Shelf randomShelf = shelves[Random.Range(0, shelves.Count)]; Subshelf randomSubshelf = randomShelf.subshelves[Random.Range(0, randomShelf.subshelfAmount)]; output.Add(randomSubshelf.subshelfItem); } //We need to sort the list based on warehouse layout output.Sort(); //Finally, we return the list. return(output); }