Ejemplo n.º 1
0
        public bool MoveExhibit(double oldX, double oldY, double newX, double newY)
        {
            var oldExhibit = GetExhibit(oldX, oldY);
            var problem    = IsProblemToBuild(newX, newY);

            if (oldExhibit == null || problem)
            {
                return(false);
            }
            var equipment  = oldExhibit.GetEquipment();
            var newExhibit = new Exhibit(newX, newY, equipment);
            var animals    = oldExhibit.GetAnimals();

            foreach (var animal in animals)
            {
                newExhibit.AddAnimal(animal);
            }
            RegisterExhibit(newExhibit);
            RemoveExhibit(ref oldExhibit);
            return(true);
        }
Ejemplo n.º 2
0
 private void RegisterExhibit(Exhibit newExhibit)
 {
     // would be some database INSERT
     exhibits.Add(newExhibit);
 }
Ejemplo n.º 3
0
 private void RemoveExhibit(ref Exhibit exhibit)
 {
     exhibits.Remove(exhibit);
     exhibit = null; //destroyed
 }