// Through this method, we will handling the demand for an elevator from the central panel public void assignElevator(int _requestedFloor, String _direction) { Column column = this.findBestColumn(_requestedFloor); //Console.WriteLine("- Selected Column: " + column.name); Elevator elevator = column.findElevator(1, _direction); //Console.WriteLine("- Selected Elevator: " + elevator.name); elevator.floorRequestList.Add(_requestedFloor); elevator.move(); }
//Through this method we will handling the demand for an elevator from your current floor public Elevator requestElevator(int _requestedFloor, String _direction) { //Console.WriteLine("- Current column: " + this.name); Elevator elevator = this.findElevator(_requestedFloor, _direction); //Console.WriteLine("- Selected Elevator: " + elevator.name); elevator.floorRequestList.Add(_requestedFloor); elevator.sortFloorList(); elevator.move(); return(elevator); }