示例#1
0
        private static void HandleFindProduce(ref Decorators.FarmAnimal moddedAnimal, ref Location moddedLocation)
        {
            var moddedPlayer = new Farmer(Game.GetPlayer());

            if (!IsValidLocation(moddedLocation) || !CanFindProduce(moddedAnimal, moddedPlayer) ||
                Random.NextDouble() >= 0.0002 || !HasNoImpediments(moddedAnimal, moddedLocation))
            {
                return;
            }
            if (moddedPlayer.IsCurrentLocation(moddedLocation.GetOriginal()))
            {
                BellsAndWhistles.PlaySound("dirtyHit", 450);
                BellsAndWhistles.PlaySound("dirtyHit", 900);
                BellsAndWhistles.PlaySound("dirtyHit", 1350);
            }

            if (Game.IsCurrentLocation(moddedLocation.GetOriginal()))
            {
                moddedAnimal.AnimateFindingProduce();
            }
            else
            {
                moddedAnimal.FindProduce(moddedPlayer.GetOriginal());
            }
        }