// Since most stations have their own inventory used in their operations // each station can call this to generate an inventory panel for itself public InventoryPanel AddInventoryPanel(Inventory inventory) { GameObject inventoryPanelPrefab = GameplayManager.instance.inventoryPanelPrefab; GameObject inventoryPanel = Instantiate(inventoryPanelPrefab); inventoryPanel.transform.SetParent(GameObject.FindGameObjectWithTag("Canvas").transform, false); InventoryPanel panel = inventoryPanel.GetComponent <InventoryPanel>(); panel.inventory = inventory; panel.AddCallbacks(); Vector3 inventoryPoint = transform.position + new Vector3(0.5f, -0.5f); Vector3 targetPos = Camera.main.WorldToScreenPoint(inventoryPoint); inventoryPanel.transform.position = targetPos; return(panel); }
void Start() { // Add inventory panels for the table and for customer salad if (tableInventory != null) { tablePanel = AddInventoryPanel(tableInventory); } if (saladInventory != null) { saladPanel = AddInventoryPanel(saladInventory); } gameManager = GameplayManager.instance; // Setup callbacks, place inventory HUD elements in correct position, set up the station statusBar.onTimerCompleteCallback += HandleTimeUp; saladPanel.AddCallbacks(); saladPanel.transform.position = Camera.main.WorldToScreenPoint(saladPoint.position); salads = gameManager.salads; ResetStation(0f, 5f); }