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(); }
private void OnCollisionEnter(Collision collision) { //Debug.LogFormat("{0} Hand Hit: {1}", hand, collision.gameObject.name); switch (pickupState) { case PickupState.Seeking: if (collision.gameObject == pickupTarget) { //if the target is food, basket, or plate switch (pickupTarget.tag) { case "food": case "fryBasket": case "plate": Grabbable grab = pickupTarget.GetComponent <Grabbable>(); if (grab.Held) { break; } grab.Pickup(this); holding = grab; pickupTarget = null; //Debug.LogFormat("Hand {0} Grabbed the {1}", hand, holding.name); break; } } break; case PickupState.Idle: if (collision.gameObject.tag == "hand" && this.HoldingSomething && this.holding.tag == "food") { //Debug.LogFormat("Hand {0} hit the other hand", hand); HandBehavior otherHand = collision.gameObject.GetComponent <HandBehavior>(); if (otherHand.HoldingSomething && otherHand.holding.tag == "food") { FoodBehavior thisFood = holding.GetComponent <FoodBehavior>(); FoodBehavior otherFood = otherHand.holding.GetComponent <FoodBehavior>(); Debug.LogFormat("We both have food! I Have {0} They have {1}", thisFood.foodType, otherFood.foodType); StageSettings_ld48 settings = (StageSettings_ld48)sceneWrangler.currentSceneContainer.stageSettings; switch (thisFood.foodType, otherFood.foodType) { case (FoodBehavior.FoodType.Duck, FoodBehavior.FoodType.Chicken): if (otherFood.doneness != FoodBehavior.Doneness.Raw) { //form a ducken Debug.Log("Form the Ducken!"); GameObject ducken = Instantiate(settings.DuckenPrefab, thisFood.transform.position, thisFood.transform.rotation) as GameObject; Grabbable duckenGrabbable = ducken.GetComponent <Grabbable>(); particleSystem.Play(); this.holding = duckenGrabbable; duckenGrabbable.Pickup(this); otherHand.holding = null; Destroy(thisFood.gameObject); Destroy(otherFood.gameObject); } break; case (FoodBehavior.FoodType.Turkey, FoodBehavior.FoodType.Ducken): if (otherFood.doneness != FoodBehavior.Doneness.Raw) { //form the turducken Debug.Log("Form the Turducken!"); GameObject turducken = Instantiate(settings.TurduckenPrefab, thisFood.transform.position, thisFood.transform.rotation) as GameObject; Grabbable turduckenGrabbable = turducken.GetComponent <Grabbable>(); particleSystem.Play(); this.holding = turduckenGrabbable; turduckenGrabbable.Pickup(this); otherHand.holding = null; Destroy(thisFood.gameObject); Destroy(otherFood.gameObject); } break; } }
private void OnPickup(HandBehavior hand) { StageSettings_ld48 settings = (StageSettings_ld48)sceneWrangler.currentSceneContainer.stageSettings; Instantiate(settings.PlatePrefab, this.transform.position, this.transform.rotation); }