コード例 #1
0
        private static void HandleNewborn(
            ref Decorators.AnimalHouse moddedAnimalHouse,
            string name,
            ref QuestionEvent questionEvent,
            Farmer moddedPlayer)
        {
            var withEggReadyToHatch = moddedAnimalHouse.GetIncubatorWithEggReadyToHatch();
            var moddedParent        = new Decorators.FarmAnimal(questionEvent.animal);
            var dictionary          = FarmAnimals.GroupTypesByCategory().Where(kvp => kvp.Value.Contains(moddedParent.GetTypeString()))
                                      .ToDictionary(kvp => kvp.Key, kvp => moddedPlayer.SanitizeBlueChickens(kvp.Value));
            var randomTypeFromProduce = moddedParent.GetRandomTypeFromProduce(dictionary);
            var building   = moddedAnimalHouse.GetBuilding();
            var farmAnimal = new Decorators.FarmAnimal(moddedPlayer.CreateFarmAnimal(randomTypeFromProduce, name, building));

            farmAnimal.AssociateParent(questionEvent.animal);
            farmAnimal.AddToBuilding(building);
            farmAnimal.SetCurrentProduce(-1);
            Event.ForceQuestionEventToProceed(questionEvent);
        }