Exemplo n.º 1
0
 public Pilot(PilotProfile profile, DateTime educationTime, PilotRating rating)
 {
     Profile = profile;
     EducationTime = educationTime;
     Rating = rating;
     Aircrafts = new List<string>();
 }
Exemplo n.º 2
0
        //creates a number of instructors
        public static void CreateInstructors(int count)
        {
            List <Town> towns = Towns.GetTowns();

            Random rnd = new Random();

            for (int i = 0; i < count; i++)
            {
                Town         town      = towns[rnd.Next(towns.Count)];
                DateTime     birthdate = MathHelpers.GetRandomDate(GameObject.GetInstance().GameTime.AddYears(-Pilot.RetirementAge), GameObject.GetInstance().GameTime.AddYears(-23));
                PilotProfile profile   = new PilotProfile(Names.GetInstance().getRandomFirstName(town.Country), Names.GetInstance().getRandomLastName(town.Country), birthdate, town);

                Dictionary <PilotRating, int> rankings = new Dictionary <PilotRating, int>();
                rankings.Add(PilotRatings.GetRating("A"), 10);
                rankings.Add(PilotRatings.GetRating("B"), 20);
                rankings.Add(PilotRatings.GetRating("C"), 40);
                rankings.Add(PilotRatings.GetRating("D"), 20);
                rankings.Add(PilotRatings.GetRating("E"), 10);

                PilotRating ranking = AIHelpers.GetRandomItem <PilotRating>(rankings);

                Instructor instructor = new Instructor(profile, ranking);

                Instructors.AddInstructor(instructor);
            }
        }
Exemplo n.º 3
0
        //creates the pilot rating for a pilot student
        public static PilotRating GetPilotStudentRating(Instructor instructor)
        {
            PilotRating instructorRanking = instructor.Rating;
            int         aircraftCoeff     = instructor.FlightSchool.TrainingAircrafts.Exists(a => a.Type.MaxNumberOfStudents > 5) ? 10 : 0;

            int instructorRankingIndex             = PilotRatings.GetRatings().IndexOf(instructorRanking);
            Dictionary <PilotRating, int> rankings = new Dictionary <PilotRating, int>();

            rankings.Add(instructorRanking, 50);

            if (instructorRankingIndex > 0)
            {
                PilotRating prevRating = PilotRatings.GetRatings()[instructorRankingIndex - 1];
                rankings.Add(prevRating, 35 - aircraftCoeff);
            }
            if (instructorRankingIndex < PilotRatings.GetRatings().Count)
            {
                PilotRating nextRating = PilotRatings.GetRatings()[instructorRankingIndex + 1];

                rankings.Add(nextRating, 15 + aircraftCoeff);
            }

            PilotRating rating = AIHelpers.GetRandomItem <PilotRating>(rankings);

            return(rating);
        }
Exemplo n.º 4
0
        //creates a number of pilots
        public static void CreatePilots(int count)
        {
            List <Town> towns = Towns.GetTowns();

            Random rnd = new Random();

            for (int i = 0; i < count; i++)
            {
                Town     town      = towns[rnd.Next(towns.Count)];
                DateTime birthdate = MathHelpers.GetRandomDate(GameObject.GetInstance().GameTime.AddYears(-Pilot.RetirementAge), GameObject.GetInstance().GameTime.AddYears(-23));

                PilotProfile profile = new PilotProfile(Names.GetInstance().getRandomFirstName(town.Country), Names.GetInstance().getRandomLastName(town.Country), birthdate, town);

                PilotRating rating = GetPilotRating();

                int fromYear = Math.Min(GameObject.GetInstance().GameTime.Year - 1, birthdate.AddYears(23).Year);
                int toYear   = Math.Min(GameObject.GetInstance().GameTime.Year, birthdate.AddYears(Pilot.RetirementAge).Year);

                DateTime educationTime = MathHelpers.GetRandomDate(birthdate.AddYears(23), new DateTime(toYear, 1, 1));
                Pilot    pilot         = new Pilot(profile, educationTime, rating);

                pilot.Aircrafts = GetPilotAircrafts(pilot);

                Pilots.AddPilot(pilot);
            }
        }
Exemplo n.º 5
0
 public Pilot(PilotProfile profile, DateTime educationTime, PilotRating rating)
 {
     this.Profile = profile;
     this.EducationTime = educationTime;
     this.Rating = rating;
     this.Aircrafts = new List<string>();
 }
Exemplo n.º 6
0
 public PilotStudent(PilotProfile profile, DateTime startDate, Instructor instructor, PilotRating rating,string airlinerfamily)
 {
     this.Rating = rating;
     this.Profile = profile;
     this.StartDate = startDate;
     this.EndDate = this.StartDate.AddDays(this.Rating.TrainingDays);
     this.Instructor = instructor;
     this.AirlinerFamily = airlinerfamily;
 }
Exemplo n.º 7
0
 public PilotStudent(
     PilotProfile profile,
     DateTime startDate,
     Instructor instructor,
     PilotRating rating,
     string airlinerfamily)
 {
     Rating = rating;
     Profile = profile;
     StartDate = startDate;
     EndDate = StartDate.AddDays(Rating.TrainingDays);
     Instructor = instructor;
     AirlinerFamily = airlinerfamily;
 }
Exemplo n.º 8
0
 public Pilot(PilotProfile profile, DateTime educationTime, PilotRating rating)
 {
     this.Profile = profile;
     this.EducationTime = educationTime;
     this.Rating = rating;
 }
Exemplo n.º 9
0
        private static void CreatePilotRatings()
        {
            var ratingA = new PilotRating("A", 70, 3);
            ratingA.AddAircraft(TrainingAircraftTypes.GetAircraftType("Cessna 172"));
            ratingA.AddAircraft(TrainingAircraftTypes.GetAircraftType("Beechcraft King Air 350"));
            PilotRatings.AddRating(ratingA);

            var ratingB = new PilotRating("B", 85, 4);
            ratingB.AddAircraft(TrainingAircraftTypes.GetAircraftType("Cessna 172"));
            ratingB.AddAircraft(TrainingAircraftTypes.GetAircraftType("Beechcraft King Air 350"));
            PilotRatings.AddRating(ratingB);

            var ratingC = new PilotRating("C", 95, 5);
            ratingC.AddAircraft(TrainingAircraftTypes.GetAircraftType("Beechcraft King Air 350"));
            PilotRatings.AddRating(ratingC);

            var ratingD = new PilotRating("D", 120, 7);
            ratingD.AddAircraft(TrainingAircraftTypes.GetAircraftType("Beechcraft King Air 350"));
            PilotRatings.AddRating(ratingD);

            var ratingE = new PilotRating("E", 150, 10);
            ratingE.AddAircraft(TrainingAircraftTypes.GetAircraftType("Beechcraft King Air 350"));
            PilotRatings.AddRating(ratingE);
        }
Exemplo n.º 10
0
 public Instructor(PilotProfile profile, PilotRating rating)
 {
     this.Profile = profile;
     this.Rating = rating;
     this.Students = new List<PilotStudent>();
 }
Exemplo n.º 11
0
 public PilotBuilder WithRating(PilotRating rating)
 {
     _rating = rating;
     return(this);
 }
Exemplo n.º 12
0
 public Instructor(PilotProfile profile, PilotRating rating)
 {
     Profile = profile;
     Rating = rating;
     Students = new List<PilotStudent>();
 }