Class: Passenger


# Passenger

Every passenger on the map is an instance of the Passenger class.

Passengers want to get from their initi City to their destination city, your task is to help them using your Vehicles.

Constructor

# new Passenger ()

Example

Example of Vehicle taking a passenger and delivering him to his desired City

function init (vehicles, cities, passengers, game) {
   
   // assuming they are in the same city
   let vehicle = vehicle[0];
   let passenger = passengers[0];
   
   // assuming the cities are adjacent
   vehicle.moveTo(passenger.toCity);
 
   vehicle.on('visitCity', function(city) {
     if (city === passenger.toCity)
       vehicle.unload(passenger);
   });
} 



# Members

# Passenger.id {string}

Type: string
Description

Passenger's id (may be between "A" and "Z").




# Passenger.lastCity {City}

Type: City
Description

The last City this passenger has been in.




# Passenger.fromCity {City}

Type: City
Description

The City this passenger is from.




# Passenger.toCity {City}

Type: City
Description

The City this passenger desires to go to.




# Passenger.onBoard {Vehicle}

Type: Vehicle
Description

Current Vehicle that this passenger is in. It is undefined if the passenger is not in a vehicle.




# Passenger.waitingTime {Integer}

Type: Integer
Description

The time that this passengers has been waiting to be delivered.