public void AddBigCarnivoresToNewWagon(Animal animal) { if (animal.GetAnimalSize() == AnimalSize.Large && animal.GetAnimalEat() == AnimalEatOptions.Carnivore) { Wagon wagon = new Wagon(); wagon.AddAnimal(animal); WagonList.Add(wagon); } }
public void addToNewWagon(Animal animal) { //List<Animal> newAnimalList = new List<Animal>(); //newAnimalList.Add(animal); Wagon newWagon = new Wagon(); newWagon.AddAnimal(animal); Wagons.Add(newWagon); Console.WriteLine(Wagons); }
public void AddMediumCarnivoresToNewWagon(Animal animal) { bool added = false; bool needToAdd = false; if (animal.GetAnimalSize() == AnimalSize.Medium && animal.GetAnimalEat() == AnimalEatOptions.Carnivore) { needToAdd = true; foreach (var w in WagonList) { if (w.freeSpacePoints >= 3) { bool dangerous = false; List <Animal> animals = w.GetAnimals(); foreach (var a in animals) { if (a.GetAnimalEat() == AnimalEatOptions.Carnivore && a.GetAnimalSize() == AnimalSize.Large) { dangerous = true; } if (a.GetAnimalEat() == AnimalEatOptions.Carnivore && a.GetAnimalSize() == AnimalSize.Medium) { dangerous = true; } } if (!dangerous) { added = true; w.AddAnimal(animal); } } } } if (!added && needToAdd) { Wagon wagon = new Wagon(); wagon.AddAnimal(animal); WagonList.Add(wagon); } }