// 食事中処理 private IEnumerator Eating(RoastController meatController) { yield return(new WaitForSeconds(eatingTime / 2)); // 食べ物画像変更 meatController.ChangeEatingEmage(); yield return(new WaitForSeconds(eatingTime / 2)); // 食べる実処理 meatController.EatObject(); // 食事完了 isEating = false; }
// Update is called once per frame void Update() { // 自皿に物が置いてある場合 // →食べてる最中 // →食べ物の移動、選択ができない if (gameObject.transform.childCount > 0 && !isEating) { isEating = true; // 自分の更には1個のオブジェクトのみ // 食事中処理 foreach (Transform child in gameObject.transform) { RoastController roastController = child.GetComponent <RoastController>(); StartCoroutine("Eating", roastController); } } }
// Start is called before the first frame update void Start() { roastController = transform.GetComponent <RoastController>(); plateController = GameObject.Find("Plate").GetComponent <PlateController>(); gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); }