private IEnumerator FishRoutine(ItemProvider source, int quantity)
        {
            is_fishing = true;

            float timer = 0f;

            while (is_fishing && timer < 3f)
            {
                yield return(new WaitForSeconds(0.02f));

                timer += 0.02f;

                if (IsMoving())
                {
                    is_fishing = false;
                }
            }

            if (is_fishing)
            {
                source.RemoveItem();
                source.GainItem(this, quantity);
            }

            is_fishing = false;
        }
示例#2
0
        public override void DoAction(PlayerCharacter character, ItemSlot slot, Selectable select)
        {
            if (select.HasGroup(merge_target))
            {
                ItemProvider  provider  = select.GetComponent <ItemProvider>();
                InventoryData inventory = slot.GetInventory();

                provider.RemoveItem();
                provider.PlayTakeSound();
                inventory.RemoveItemAt(slot.index, 1);
                character.Inventory.GainItem(inventory, filled_item, 1);
            }
        }
        public override void DoAction(PlayerCharacter character, Selectable select)
        {
            if (select != null)
            {
                character.FaceTorward(select.transform.position);

                ItemProvider pond = select.GetComponent <ItemProvider>();
                if (pond != null)
                {
                    if (pond.HasItem())
                    {
                        character.FishItem(pond, 1);
                    }
                }
            }
        }
        //Fish item from a fishing spot
        public void FishItem(ItemProvider source, int quantity)
        {
            if (source != null && source.HasItem())
            {
                is_fishing = true;

                if (source != null)
                {
                    FaceTorward(source.transform.position);
                }

                TriggerAction(0.4f, () =>
                {
                    action_routine = StartCoroutine(FishRoutine(source, quantity));
                });
            }
        }
示例#5
0
        public override bool CanDoAction(PlayerCharacter character, ItemSlot slot, Selectable select)
        {
            ItemProvider provider = select != null?select.GetComponent <ItemProvider>() : null;

            return(provider != null && provider.HasItem());
        }
        public override bool CanDoAction(PlayerCharacter character, Selectable select)
        {
            ItemProvider pond = select.GetComponent <ItemProvider>();

            return(pond != null && pond.HasItem() && character.EquipData.HasItemInGroup(fishing_rod) && !character.IsSwimming());
        }