Generally, we use "on" with public transport(larger), like train, bus, tram, MTR etc. and "in" with cars(smaller like a box) of private nature. It also depends on your angle of perspective. On a horizontal view, the passenger is getting "on" it(the deck). On the other hand, if you view the transport as "a box", the passenger is gettng in/into it. Accordingly,in the second sentence, we use "off" if it is a bus and "out of" if it is a car .