private void OnTriggerStay(Collider target) { if (target.tag == "BearFood" && !circleStateManager.CheckFoodExists(this.gameObject)) { circleStateManager.ChangeFoodState(this.gameObject, FoodCircleState.Filled); target.transform.SetParent(bearManager.GetChildObjectByName("BearFoodBag").transform); // 兩隻熊同時碰到同個食物 要怎麼處理,目前想法 開個共同管理 入Queue 根據距離中心遠近,近的就能搶到食物。 // 若相同距離,則比較餓的會先吃 } }
private void TossFoodOnBearHead() { if (!circleStateManager.CheckFoodExists(hit.collider.gameObject)) { var cloneBearFood = Instantiate(bearFood, hit.point, Quaternion.identity); cloneBearFood.transform.SetParent(hit.collider.gameObject.transform.parent.Find("BearFoodBag")); circleStateManager.ChangeFoodState(hit.collider.gameObject, CircleState.FoodCircleState.Filled); onPlayerTossBearFood.Invoke(); } }