Beispiel #1
0
        /// <summary>
        /// Bites the lure with the given fish.
        /// </summary>
        /// <param name="fish">The biting fish.</param>
        /// <returns>True if the bite hooked the fish; otherwise, false.</returns>
        public bool BiteLure(Fish fish)
        {
            bool hooked = Lure.BiteLure(fish, _hookedFish);

            if (hooked)
            {
                if (_hookedFish == null)
                {
                    _hookedFish = fish;
                    OnFishingEvent(FishingEvent.FishHooked);
                }
                else
                {
                    _hookedFish.OnEaten();
                    OnFishingEvent(FishingEvent.FishEaten);
                    _hookedFish = fish;
                }
            }
            else
            {
                if (_hookedFish != null)
                {
                    _hookedFish.OnEaten();
                    OnFishingEvent(FishingEvent.FishEaten);
                    _hookedFish = null;
                }
                _lureBroken = true;
                OnFishingEvent(FishingEvent.LureBroke);
            }
            return(hooked);
        }