public Pilot(PilotProfile profile, DateTime educationTime, PilotRating rating) { Profile = profile; EducationTime = educationTime; Rating = rating; Aircrafts = new List<string>(); }
//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); } }
//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); }
//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); } }
public Pilot(PilotProfile profile, DateTime educationTime, PilotRating rating) { this.Profile = profile; this.EducationTime = educationTime; this.Rating = rating; this.Aircrafts = new List<string>(); }
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; }
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; }
public Pilot(PilotProfile profile, DateTime educationTime, PilotRating rating) { this.Profile = profile; this.EducationTime = educationTime; this.Rating = rating; }
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); }
public Instructor(PilotProfile profile, PilotRating rating) { this.Profile = profile; this.Rating = rating; this.Students = new List<PilotStudent>(); }
public PilotBuilder WithRating(PilotRating rating) { _rating = rating; return(this); }
public Instructor(PilotProfile profile, PilotRating rating) { Profile = profile; Rating = rating; Students = new List<PilotStudent>(); }