public RouteManager.Orientation get_station_orientation_with_room() { RouteManager.Orientation orientation = RouteManager.Orientation.East; foreach (KeyValuePair <string, GameObject> entry in building_map) { // do something with entry.Value or entry.Key BuildingLot bldg_lot = entry.Value.GetComponent <BuildingLot>(); int train_count = bldg_lot.get_train_count(); if (train_count < 2) // stations are not full { if (train_count < bldg_lot.building.get_occupancy_count()) { if (!bldg_lot.building.is_building_empty()) { return(bldg_lot.orientation); } else { orientation = bldg_lot.orientation; } } else { orientation = bldg_lot.orientation; } } } return(orientation); }