Skip to content

Order Releases

Aidan Mathieu edited this page Apr 13, 2026 · 1 revision

The order release system is composed of two scripts that send information to each other:

  • OrderUI
  • forkliftOrderManager

Order UI

This script is for handling input and displaying options and current releases to the user.

addOrder()

This function takes the input that the user created in the UI and creates a new order current Order. The current orders are stored in a list of forkliftOrderManager.Order objects called currOrders. It will also call the updateOrders() function when it succeeds. This will make a call to data Collector to keep track of added orders.

updateOrders()

This will update the UI order page to make it properly show the currently created orders and give the user the opportunity to change or delete the orders that they have created before confirming them. All this does it update the UI scroll view.

updateOrder()

When the user changes an order using the UI scroll view list, this function will be called. It will go to the proper object in the currOrders list and change the values. It will then update the UI to reflect these changes.

updateOutgoingOrders()

This function is used to show the currently confirmed orders. When the user clicks the button in the bottom left corner to show current orders, this function is called which will update the UI list. Unlike updateOrders(), the user will not have the ability to change any of the orders at this point.

finalizeOrder()

Once the user is certain that their current orders are the ones that they want, they will press the button in the bottom right corner to set the orders which calls this function. Calling this function will send the order objects from currOrders to the forkliftOrderManager which will then be used to have the forklifts bring bottles out to the lines. This will make a call to data Collector to make note of the finalized order. This will also make a call to the PointsTracker script so that they will lose money based on how much they ordered.

forkliftOrderManager

This script will check if there is an order, if enough time has passed between orders, if there is a forklift available, and if it is time for the order to be released, and if so, it will create a forklift object to bring bottles out to the correct conveyor line.

makeShipment()

If a shipment is going to be made, this script is called to start the sendOrder coroutine with the correct number of bottles and to go to the correct conveyor line.

IEnumerator sendOrder()

This is a coroutine which means it acts asynchronously to the other functions that are called. When it is called with a set conveyor line to go to and a set number of bottles, it will instantiate the forklift and the bottles that it holds. It will then use Unity's path finding algorithm to go to the correct conveyor line and attempt to drop the bottles in the funnel. If the funnel cannot hold all of the bottles, the forklift will wait and the user will lose more money. Once all of the bottles are dropped off, the forklift will go back and then be destroyed.

Clone this wiki locally