void cooking() { //print ("cooking"); sprite_oven.SetBool("closed", true); if (!set) { audio.Play(); usage = Time.time + delay; set = true; //put a blank pizza, reset toppings pizza.gameObject.transform.position = pizzaSpawn; //print("number of pizza children " + pizza.transform.childCount); pizza.gameObject.renderer.enabled = true; //scoreSystem.scoreUpdate(); } if (Time.time > usage) { audio.Pause(); set = false; next_state = ovenState.done; GameObject.FindGameObjectWithTag("phone").GetComponent <phone>().next_state = PhoneState.ringing; GameObject.FindGameObjectWithTag("phone").audio.loop = true; GameObject.FindGameObjectWithTag("phone").audio.Play(); } }
// Update is called once per frame void Update() { switch (cur_state) { case ovenState.cooking: cooking(); break; case ovenState.done: done(); break; case ovenState.empty: empty(); break; } cur_state = next_state; }
// Use this for initialization void Start() { cur_state = ovenState.empty; pizzaSpawn = pizza.gameObject.transform.position; scoreSystem = GameObject.FindGameObjectWithTag("scoring").GetComponent <Scoring>(); }