public void createAnimal() { AnimalsRequirements requirements = new AnimalsRequirements(); requirements.HasFourLegs = HasFourLegs; requirements.Feline = Feline; requirements.FarmAnimal = FarmAnimal; requirements.Deadly = Deadly; AnimalsFactory factory = new AnimalsFactory(requirements); IAnimals v = factory.Create(); Debug.Log(v); if (v.ToString() == "Lion") { Instantiate(Lion); } else if (v.ToString() == "Catto") { Instantiate(Cat); } else if (v.ToString() == "Doggo") { Instantiate(Dog); } else if (v.ToString() == "Chicken") { Instantiate(Chicken); } else if (v.ToString() == "Penguin") { Instantiate(Penguin); } }
public ConsoleMenuService(Zoo zoo) { _reader = new ConsoleReaderService(); _notification = new ConsoleNotificationService(); //Сервисы ввода/вывода в консоль _animalParser = new ConsoleAnimalParserService(); _fileReader = new FileReader(_animalParser); _fileWriter = new FileWriter(); _service = new ConsoleAnimalCreatorService(_reader, _notification); AnimalsFactory factory = AnimalsFactory.CreateFactory(_service); _zoo = zoo; _dict = new Dictionary <string, ICommand>() { { "1", new AddAnimalCommand(_zoo, factory, _notification, _reader) }, // TODO: Вводить "ваше животное успешно добавлено" { "2", new DeleteAnimalCommand(_zoo, _notification, _reader) }, // TODO: Вводить "ваше животное успешно удалено" { "3", new PrintAnimalInfoCommand(_zoo, _notification, _reader) }, //TODO: Убрать вывод животных над меню { "4", new AnimalMakeSoundCommand(_zoo, _notification, _reader) }, { "5", new PrintAllAnimalsInfoCommand(_zoo, _notification) }, { "6", new AllAnimalMakeSoundCommand(_zoo) }, { "7", new FileReadCommand(_zoo, _notification, _reader, _fileReader) }, { "8", new FileWriteCommand(_zoo, _fileWriter) }, { "0", new ExitCommand() } }; }
public AnimalCentre() { this.hotel = new Hotel(); this.animalsFactory = new AnimalsFactory(); this.proceduresFactory = new ProceduresFactory(); this.procedures = new Dictionary <string, IProcedure>(); this.adoptedAnimals = new Dictionary <string, List <IAnimal> >(); }
public AnimalCentre() { animalFactory = new AnimalsFactory(); procedurFactory = new ProcedurFactory(); adopted = new Dictionary <string, List <string> >(); procedures = new Dictionary <string, Procedure>(); hotel = new Hotel(); }
private void cbTwo_SelectedIndexChanged(object sender, EventArgs e) { viewAnTwo = AnimalsFactory.CreateAnimals(cbTwo.SelectedItem.ToString()); tbTwo.Text = MassaAnimals.MassaView(viewAnTwo, cbUnit.SelectedItem); if (cbUnit.SelectedItem != null) { tbAnalize.Text = MassaAnimals.MassaCompare(viewAnOne, viewAnTwo); } }
public AddAnimalCommand(Zoo zoo, AnimalsFactory factory, INotificationService notificationService, IReaderService readerService) : base(zoo, notificationService, readerService) { _dict = new Dictionary <string, string>() { { "1", "Cat" }, { "2", "Dog" }, { "3", "Chicken" }, { "4", "Stork" }, { "5", "Tiger" }, { "6", "Wolf" } }; _factory = factory; }
private void Form1_Load(object sender, EventArgs e) { cbOne.Items.AddRange(AnimalsFactory.ListNamesAnimals()); cbTwo.Items.AddRange(AnimalsFactory.ListNamesAnimals()); cbUnit.Items.AddRange(MassaAnimals.ListUnitMass()); }
public AnimalsWorld(AnimalsFactory animalsFactory) { _herbivore = animalsFactory.GetHerbivore(); _carnivore = animalsFactory.GetCarnivore(); }