Exemple #1
0
 private bool CompatibilityCheck(Animal animal)
 {
     //Hier wordt elke dier in wagon gecontroleerd of er zelfde type en soort in zit(Alleen geldig voor VleesEter)
     return(AnimalToWagon.All(animalCheck => (animalCheck.grootteType > animal.grootteType ||
                                              animal.animalType != AnimalTypes.VleesEter) &&
                              (animalCheck.animalType != AnimalTypes.VleesEter ||
                               animalCheck.grootteType < animal.grootteType)));
 }
Exemple #2
0
 public bool AddToWagon(Animal animal)
 {
     //Hier wordt animals toegevoegd in wagon(Alleen als CompatibilityCheck en CheckSize goedgekeurd wordt)
     if (!CompatibilityCheck(animal) || !sizeCheck(animal))
     {
         return(false);
     }
     //Na het toegevoegd animal wordt capaciteit van de wagon aangepast
     AnimalToWagon.Add(animal);
     animal.AnimalAdded = true;
     Capacity           = Capacity - (int)animal.grootteType;
     return(true);
 }