// Actions sur le chariot private void ActionFoodSlot(FoodSlotController foodSlot) { if (IsPressedAction(1) == true) { TakeFood(foodSlot); } }
private void TakeFood(FoodSlotController foodSlot) { if (_vegetableCarried == null) { VegetableConfig vegetableConfig = foodSlot.Take(); if (vegetableConfig != null) { _vegetableCarried = vegetableConfig; _playerCanvas.EnableFeedback("Food/food_" + vegetableConfig.name.ToLower(), true); } } }
private void OnTriggerStay(Collider other) { if (other.tag == "Children" && other.transform.parent.parent.gameObject.tag == "SpawnerPlayer" + _joystickNumber.ToString()) { _childInRange = other.GetComponentInParent <Child>(); _childInRange.GetComponentInChildren <Renderer>().material = _body.material; ActionChild(); } else if (other.tag == "FoodSlot") { FoodSlotController foodSlot = other.GetComponent <FoodSlotController>(); ActionFoodSlot(foodSlot); } }