Пример #1
0
        public bool Drink(IDrinkable drinkable)
        {
            if (IsInReach(drinkable))
            {
                drinkable.Drink().ApplyOn(transform.parent.gameObject);
                return(true);
            }

            return(false);
        }
Пример #2
0
    private void OnTriggerStay(Collider other)
    {
        if (other.CompareTag("Hydrator"))
        {
            if (drinkRef == null)
            {
                return;
            }
            if (Input.GetButton("Interact"))
            {
                ModifyHydration(drinkRef.Drink());
            }
        }
        if (other.CompareTag("Feeder"))
        {
            if (foodRef == null)
            {
                return;
            }
            if (Input.GetButton("Interact"))
            {
                ModifyHunger(foodRef.Eat());
                foodRef = null;
            }
        }

        var hint = other.GetComponent <IHintable>();

        if (Input.GetButton("Interact"))
        {
            var success = hint?.CollectHint();
            if (success != null && (bool)success)
            {
                InteractionText.gameObject.SetActive(false);
            } //Tell the player they messed up?
        }
    }