//Creer un lot de cargaison pour un aeroport private CClients CreerCargaison(int min, int max, CAeroport SelfAero) { Random rand = new Random(DateTime.Now.Millisecond); double quantite = rand.Next((min * 10), (max * 10)); UsineClient usineClient = new UsineClient(); return(usineClient.creeClient(PrendreAeroportRand(SelfAero), quantite)); }
//Prend un aeroport random comme destination private CAeroport PrendreAeroportRand(CAeroport SelfAero) { CAeroport Destination; Random rand = new Random(DateTime.Now.Millisecond); int ind = rand.Next(0, this.ListeAeroports.Count()); if (this.ListeAeroports[ind] != SelfAero) { Destination = this.ListeAeroports[ind]; return(Destination); } else { PrendreAeroportRand(SelfAero); } return(null); }
//trouve l'aeroport la plus proche d'une position private CAeroport TrouverAeroportProche(Position mapPosition, typeAvion avionType) { List <CAeroport> cAeroports = ListeAeroports.FindAll(aeroports => aeroports.nbAeronef > 0); CAeroport aeroport = null;//Aeroport actuellement le plus près foreach (CAeroport Aero in cAeroports) { if (aeroport == null) { aeroport = Aero; } else if (CalculerDistance(aeroport.position, mapPosition) > CalculerDistance(Aero.position, mapPosition)) { if (Aero.Listaeronefs.Exists(aeronef => aeronef.Type == avionType)) { aeroport = Aero; } } } return(aeroport); }
public CCargaison(typeClient client, CAeroport aeroport, double poid) : base(client, aeroport) { m_poid = poid; Destination = aeroport; }
public CClients creeClient(CAeroport aeroport, double poid) { // Aeronef cargaison return(new CCargaison(typeClient.Cargaison, aeroport, poid)); }
// DansAeroport public CClients creeClient(CAeroport aeroport, int nombreClient) { // Aeronef Voyageur return(new CVoyageur(typeClient.Voyageur, aeroport, nombreClient)); }
public CVoyageur(typeClient client, CAeroport aeroport, int nombreClient) : base(client, aeroport) { this.nombreClient = nombreClient; Destination = aeroport; }
public CDansAeroport(typeClient client, CAeroport Destination) : base(client) { this.Destination = Destination; }
public void AjouterAeronef(CAeroport Aeroport, CAeronef Aeronef) { Aeroport.AjouterAeronef(Aeronef); }
public void AjouterAeroport(string nom, string ville, int posX, int posY, int minPass, int maxPass, int minCargo, int maxCargo) { CAeroport Aeroport = new CAeroport(nom, ville, minPass, maxPass, minCargo, maxCargo, posX, posY); ListeAeroports.Add(Aeroport); }