// Update is called once per frame void Update () { if(foodGiven) foodPickedUp(); if (state != stoveStates.COOKING && state != stoveStates.FOOD_READY) { if(foodQueue.Count != 0){ currentFood = foodQueue.Dequeue(); foodCount = foodQueue.Count; state = stoveStates.COOKING; StartCoroutine(cookFood()); } } }
private IEnumerator cookFood(){ float timer = 0; GameObject newPot = (GameObject)Instantiate(pot, new Vector3(this.gameObject.transform.position.x, this.gameObject.transform.position.y + 1, this.gameObject.transform.position.z), Quaternion.identity); newPot.tag = "Food"; while(timer < cookTime) { timer += Time.deltaTime; yield return null; } Destroy (newPot); //Debug.Log ("FINISHED COOKING"); state = stoveStates.FOOD_READY; //Instantiate(GameObject.Find("TomatoSoup"), new Vector3(this.gameObject.transform.position.x, this.gameObject.transform.position.y + 1, this.gameObject.transform.position.z), Quaternion.identity); //foodModel = (GameObject)Instantiate(currentFood.recipe.GetComponent<Food>().model, new Vector3(this.gameObject.transform.position.x, this.gameObject.transform.position.y + 1, this.gameObject.transform.position.z), Quaternion.identity); clocheDestroy = (GameObject)Instantiate(cloche, new Vector3(this.gameObject.transform.position.x, this.gameObject.transform.position.y + 1, this.gameObject.transform.position.z), Quaternion.identity); clocheDestroy.tag = "Food"; }
public void reset() { currentFood = null; state = stoveStates.FREE; foodQueue = new Queue<FoodScript> (); hasWaiter = false; foodGiven = false; foodCount = 0; }
public void foodPickedUp() { hasWaiter = false; //Destroy (foodModel);' Destroy (clocheDestroy); state = stoveStates.FREE; currentFood = null; foodGiven = false; }
public void Reset () { StopAllCoroutines(); state = stoveStates.FREE; foodQueue = new Queue<FoodScript>(); }