Ejemplo n.º 1
1
        public Building()
        {
            //Set exitLocation on 0 floor
            exitLocation = 677;

            //Initialize floors
            arrayOfAllFloors = new Floor[4];
            arrayOfAllFloors[0] = new Floor(this, 0, 373);
            arrayOfAllFloors[1] = new Floor(this, 1, 254);
            arrayOfAllFloors[2] = new Floor(this, 2, 144);
            arrayOfAllFloors[3] = new Floor(this, 3, 32);

            //Initialize elevators (each elevator starts on randomly choosen floor)
            arrayOfAllElevators = new Elevator[3];
            Random random = new Random();

            arrayOfAllElevators[0] = new Elevator(this, 124, arrayOfAllFloors[random.Next(arrayOfAllFloors.Length)]);
            arrayOfAllElevators[1] = new Elevator(this, 210, arrayOfAllFloors[random.Next(arrayOfAllFloors.Length)]);
            arrayOfAllElevators[2] = new Elevator(this, 295, arrayOfAllFloors[random.Next(arrayOfAllFloors.Length)]);

            //Initialize list of all people inside (to track who's inside and need to be animated)
            ListOfAllPeopleWhoNeedAnimation = new List<Passenger>();

            //Initialize ElevatorManager object
            ElevatorManager = new ElevatorManager(ArrayOfAllElevators, ArrayOfAllFloors);
        }
Ejemplo n.º 2
0
        public Building()
        {
            //Set exitLocation on 0 floor
            exitLocation = 677;

            //Initialize floors
            arrayOfAllFloors    = new Floor[4];
            arrayOfAllFloors[0] = new Floor(this, 0, 373);
            arrayOfAllFloors[1] = new Floor(this, 1, 254);
            arrayOfAllFloors[2] = new Floor(this, 2, 144);
            arrayOfAllFloors[3] = new Floor(this, 3, 32);

            //Initialize elevators (each elevator starts on randomly choosen floor)
            arrayOfAllElevators = new Elevator[3];
            Random random = new Random();

            arrayOfAllElevators[0] = new Elevator(this, 124, arrayOfAllFloors[random.Next(arrayOfAllFloors.Length)]);
            arrayOfAllElevators[1] = new Elevator(this, 210, arrayOfAllFloors[random.Next(arrayOfAllFloors.Length)]);
            arrayOfAllElevators[2] = new Elevator(this, 295, arrayOfAllFloors[random.Next(arrayOfAllFloors.Length)]);

            //Initialize list of all people inside (to track who's inside and need to be animated)
            ListOfAllPeopleWhoNeedAnimation = new List <Passenger>();

            //Initialize ElevatorManager object
            ElevatorManager = new ElevatorManager(ArrayOfAllElevators, ArrayOfAllFloors);
        }
Ejemplo n.º 3
0
        public Building()
        {
            aTimer = new Timer(10000);

            // Hook up the Elapsed event for the timer.
            aTimer.Elapsed += CreatePassenger;

            // Set the Interval to 2 seconds (2000 milliseconds).
            aTimer.Interval = 5000;
            aTimer.Enabled  = true;

            ExitLocation   = 677;
            ArrayFloors    = new Floor[4];
            ArrayFloors[0] = new Floor(this, 0, 373);
            ArrayFloors[1] = new Floor(this, 1, 254);
            ArrayFloors[2] = new Floor(this, 2, 144);
            ArrayFloors[3] = new Floor(this, 3, 32);

            ArrayOfAllElevators    = new Elevator[3];
            ArrayOfAllElevators[0] = new Elevator(this, 124, ArrayFloors[0], ElevatorManager);
            ArrayOfAllElevators[1] = new Elevator(this, 210, ArrayFloors[0], ElevatorManager);
            ArrayOfAllElevators[2] = new Elevator(this, 295, ArrayFloors[0], ElevatorManager);

            ListOfAllPeopleWhoNeedAnimation = new List <Passenger>();
            ElevatorManager = new ElevatorManager(ArrayOfAllElevators, ArrayFloors);
        }