Beispiel #1
0
        /// <summary>
        /// Checks if the player has the ability to harvest this resource.
        /// If so, it resets the <see cref="_gatherTimePassed"/> and starts the <see cref="Gather"/> coroutine.
        /// </summary>
        public override void Interact()
        {
            Equipable equipped = InventoryManager.Instance.CurrentlyEquippedItem;

            if (_notGatherable)
            {
                return;
            }

            if (neededAbility == Equipable.EquipableAbility.None ||
                equipped != null && equipped.HasAbility(neededAbility))
            {
                _gatherTimePassed = 0;
                PlayerController.SetAnimationFloat(Consts.Animation.INTERACT_SPEED_FLOAT, 1 / gatherTime);
                PlayerController.TriggerAnimation(Consts.Animation.INTERACT_TRIGGER);
                CoroutineManager.Instance.WaitForSeconds(1.0f / 60.0f, () => StartCoroutine(Gather()));
            }
            else
            {
                CoroutineManager.Instance.WaitForSeconds(1, UIManager.Instance.SpeechBubble.ShowErrorSpeechBubble);
            }
        }