Ejemplo n.º 1
0
        /// <summary>
        /// board passengers
        /// </summary>
        /// <param name="addingAmount">count of peoples in generating queue</param>
        public override List <Passenger.Passenger> BoardPassengers(int addingAmount)
        {
            List <Passenger.Passenger> tmp       = new List <Passenger.Passenger>();
            List <Passenger.Passenger> taxiQueue =
                new TaxiQueue(addingAmount).GeneratePassengers(new TaxiPassengersBuilder());

            foreach (var pretender in BoardTaxi.Instance().BoardPassenger(Passengers.Count, ref taxiQueue))
            {
                if (pretender is Adult)
                {
                    tmp.Add(pretender);
                    continue;
                }

                if (pretender is Child)
                {
                    if (ChildChairsExisting)
                    {
                        tmp.Add(pretender);
                        continue;
                    }
                    else
                    {
                        throw new Exception("Sorry, I have no childchairs");
                    }
                }

                if (pretender is Preferential)
                {
                    throw new Exception("Sorry, we don't transport preferentials");
                }
            }
            Passengers.AddRange(tmp);
            return(taxiQueue);
        }
Ejemplo n.º 2
0
 protected override Driver DriverInstance(string name)
 {
     return(Driver ??= BoardTaxi.Instance().BoardDriver(name));
 }