IEnumerator OrderResult(PlateBehavior plate, bool success) { yield return(new WaitForSeconds(1)); if (success) { Destroy(plate.gameObject); guiManager gui = FindObjectOfType <guiManager>(); gui.UpdateOrderList(); } else { Rigidbody plateBody = plate.GetComponent <Rigidbody>(); plate.gameObject.layer = 12; plate.tag = "trash"; plateBody.AddForce((Vector3.up - Vector3.forward) * 10, ForceMode.Impulse); } }
private void reloadOrderList() { List <SceneWrangler> wranglers = FindObjectsOfType <SceneWrangler>().ToList(); foreach (SceneWrangler wrangler in wranglers) { if (wrangler.levelState == LevelLoadingProcess.Idle) { sceneWrangler = wrangler; } } print("reloading order list"); armVictoryState = true; StageSettings_ld48 settings = (StageSettings_ld48)sceneWrangler.currentSceneContainer.stageSettings; orderQueue.Clear(); activeOrderList.Clear(); orderAddTimes.Clear(); if (enforceTime) { foreach (Order order in settings.recipesOrders) { orderQueue.Enqueue(order); } activeOrderList.Add(orderQueue.Dequeue()); orderAddTimes.Add(Time.time); lastAddTime = Time.time; } else { activeOrderList.AddRange(settings.recipesOrders); } guiManager gui = FindObjectOfType <guiManager>(); gui.UpdateOrderList(); }