public void construireDefenses(Batiment defense) { if (!defense.Actif) throw new Exception("Defense Non Constructible"); // Verification des ressources // Traitement du temps TimeSpan tempsConstructions = new TimeSpan(0, 0, 0, 0, 0); m_FChantier.Enqueue(new m_ObjetConstruction(defense.Nom, tempsConstructions)); m_ordreChantier.Enqueue("Defenses"); }
// Constructeur public Partie() { m_metal = 100; m_crystal = 20; m_uranium = 0; // Les Batiments m_MineMetal = new Batiment("Mine de Metal",0); m_MineCrystal = new Batiment("Mine de Crystal",0); m_MineUranium = new Batiment("Synthetiseur d'uranium235",0); m_SiloMetal = new Batiment("Silo de metal",0); m_SiloCrystal = new Batiment("Silo de crystal",0); m_SiloUranium = new Batiment("Silo d'uranium",0); m_CentraleEnergie = new Batiment("Centrale d'energie",0); m_CentraleNucleraire = new Batiment("Centrale Nucleraire",0); m_Usine = new Batiment("Usine",0); m_ChantierSpatial = new Batiment("Chantier Spatial",0); m_UsineNano = new Batiment("Usine Nanotechnique",0); m_CentreTechnique = new Batiment("Centre Technique",0); m_Convertisseur = new Batiment("Convertisseur",0); m_Terraformeur = new Batiment("Terraformeur",0); m_HangardMissile = new Batiment("Hangard a missile", 0); // Flotte m_NavLeg = 0; m_NavLrd = 0; m_Chasseur = 0; m_Escorteur = 0; m_Frégate = 0; m_Destroyer = 0; m_Croiseur = 0; m_Forteresse = 0; m_BatAmiral = 0; m_SatSol = 0; m_Collecteur = 0; m_SondeEspion = 0; //Les defenses m_CanonLaser = new Batiment("Canon Laser", 0); m_CanonIon = new Batiment("Canon a Ion", 0); m_CanonPlasma = new Batiment("Canon Plasma", 0); m_CanonGauss = new Batiment("Canon Gauss", 0); m_ChampDeForce = new Batiment("Champ de Force", 0); m_MissileInter = new Batiment("Missile Interplanetaire", 0); m_ContreMesure = new Batiment("Contre Mesure de defense", 0); m_PlateFormeSpatiale = false; m_TempsDeJeu = new TimeSpan(0, 0, 0, 0); }
public void augmenterBatiment(Batiment bat) { #region Si le batiment ne peux pas encore etre construit if (!bat.Actif) throw new Exception("Batiment Non Constructible"); #endregion // Verifier si les ressources sont ok double tempsConstruction = Math.Pow(2, bat.Niveau) * bat.TempsConstruction / (Math.Pow(2, m_Usine.Niveau) + Math.Pow(4, m_UsineNano.Niveau)); int jours =( int) (tempsConstruction / 86400); int heures = (int)((tempsConstruction - jours * 86400) / 3600); int minutes = (int)((tempsConstruction - jours * 86400 - heures * 3600) / 60); int secondes = (int) (tempsConstruction - jours * 86400 - heures * 3600 - minutes * 60); TimeSpan TempsConstruction = new TimeSpan(jours, heures, minutes, secondes); m_FConstruction.Enqueue(new m_ObjetConstruction(bat.Nom, TempsConstruction)); }
private int coefficientGros(ref Batiment bat) { int coef = 0; if(bat.Niveau == 0) return 0; else if(bat.Niveau < 10) { coef =+ 44 * bat.Niveau - 22; return coef; } else { coef =+ 88 * bat.Niveau - 460; return coef; } }
private int coefficientPetit(ref Batiment bat) { int coef = 0; if(bat.Niveau == 0) return 0; else if(bat.Niveau < 10) { coef =+ 22 * bat.Niveau - 11; return coef; } else { coef =+ 44 * bat.Niveau - 230; return coef; } }
// Constructeur public Partie() { #region resources m_metal = 100d; m_crystal = 20d; m_uranium = 0d; m_pourcentageMetal = 100; m_pourcentageCrystal = 100; m_pourcentageUranium = 100; m_pourcentageCentrale = 100; m_pourcentageNucleaire = 100; m_IncrementMetal = 0.1d; m_IncrementCrystal = 0.05d; m_IncrementUranium = 0d; m_CapaciteMaxMetal = 100000d; m_CapaciteMaxCrystal = 100000d; m_CapaciteMaxUranium = 100000d; #endregion #region Batiment m_MineMetal = new Batiment("Mine de Metal", 0, true, 20, 10, 0, 0); m_MineCrystal = new Batiment("Mine de Crystal", 0, true, 18, 8, 0, 0); m_MineUranium = new Batiment("Synthetiseur d'uranium235", 0, true, 70, 45, 0, 0); m_SiloMetal = new Batiment("Silo de metal", 0, true, 2000, 0, 0, 0); m_SiloCrystal = new Batiment("Silo de crystal", 0, true, 2000, 1000, 0, 0); m_SiloUranium = new Batiment("Silo d'uranium", 0, true, 2000, 2000, 0, 0); m_CentraleEnergie = new Batiment("Centrale d'energie", 0, true, 0, 0, 0, 0); m_CentraleNucleraire = new Batiment("Centrale Nucleraire", 0, false, 0, 0, 0, 0); m_Usine = new Batiment("Usine", 0, true, 0, 0, 0, 0); m_ChantierSpatial = new Batiment("Chantier Spatial", 0, false, 0, 0, 0, 0); m_UsineNano = new Batiment("Usine Nanotechnique", 0, false, 2000000, 2000000, 1000000, 0); m_CentreTechnique = new Batiment("Centre Technique", 0, true, 400, 800, 400, 0); m_Convertisseur = new Batiment("Convertisseur", 0, false, 0, 0, 0, 0); m_Terraformeur = new Batiment("Terraformeur", 0, false, 0, 0, 0, 0); m_HangardMissile = new Batiment("Hangard a missile", 0, true, 10000, 10000, 1000, 0); #endregion #region Technologies m_Laser = new Technologie("Laser", 0, false, 400, 200, 0, 0); m_Ion = new Technologie("Ion", 0, false, 0, 0, 0, 0); m_Plasma = new Technologie("Plasma", 0, false, 0, 0, 0, 0); m_Propulsion = new Technologie("Propulsion", 0, false, 400, 0, 600, 0); m_Hyperespace = new Technologie("Hyperespace", 0, false, 0, 0, 0, 0); m_PropulsionPoussee = new Technologie("Propulsion Amelioree", 0, false, 2000, 4000, 600, 0); //a modifier m_Espionage = new Technologie("Espionage", 0, false, 400, 1500, 300, 0); m_Crystalisateur = new Technologie("Crystalisateur", 0, false, 1000, 0, 800, 0); m_StationDeForage = new Technologie("Station de Forage", 0, false, 0, 400, 800, 0); m_StabilisationIsotopique = new Technologie("Stabilisation Isotopique", 0, false, 1200, 800, 0, 0); m_Blindage = new Technologie("Blindage", 0, false, 1000, 0, 0, 0); m_Armement = new Technologie("Armement", 0, false, 750, 250, 0, 0); m_Bouclier = new Technologie("Bouclier", 0, false, 0, 0, 0, 0); m_CoordinationDesCentres = new Technologie("Coordination des centres techniques", 0, false, 0, 0, 0, 0); m_CoordinationDesFlottes = new Technologie("Coordination des flottes", 0, false, 0, 600, 1000, 0); m_CoordinationDesPlanetes = new Technologie("Coordination des planetes", 0, false, 2000, 2500, 800, 0); m_Planetarion = new Technologie("Planetarion", 0, false, 0, 0, 0, 0); #endregion #region Flotte m_NavLeg = new Vaisseaux("Navette Legere", 0, false, 2000, 1000, 20, 5000, 0, 0, 0, 0); m_NavLrd = new Vaisseaux("Navette Lourde", 0, false, 40000, 25000, 200, 50000, 0, 0, 0, 0); m_Chasseur = new Vaisseaux("Chasseur", 0, false, 3500, 1000, 20, 50, 0, 0, 0, 0); m_Escorteur = new Vaisseaux("Escorteur", 0, false, 0, 0, 75, 100, 0, 0, 0, 0); m_Frégate = new Vaisseaux("Fregate", 0, false, 0, 0, 250, 1000, 0, 0, 0, 0); m_Destroyer = new Vaisseaux("Destroyer", 0, false, 0, 0, 350, 1250, 0, 0, 0, 0); m_Croiseur = new Vaisseaux("Croiseur", 0, false, 0, 0, 750, 500, 0, 0, 0, 0); m_Forteresse = new Vaisseaux("Forteresse", 0, false, 0, 0, 1000, 2000, 0, 0, 0, 0); m_BatAmiral = new Vaisseaux("Batiment Amiral", 0, false, 5000000, 3000000, 2500000, 10, 0, 0, 0, 0); m_SatSol = new Vaisseaux("Satellite Solaire", 0, false, 0, 2500, 0, 0, 0, 0, 0, 0); m_Collecteur = new Vaisseaux("Collecteur", 0, false, 0, 0, 300, 20000, 0, 0, 0, 0); m_SondeEspion = new Vaisseaux("Sonde Espion", 0, false, 0, 0, 5, 1, 0, 0, 0, 0); #endregion #region Defense m_CanonLaser = new Defense("Canon Laser", 0, false, 30000, 0, 0, 500, 100, 10500, 0); m_CanonIon = new Defense("Canon a Ion", 0, false, 0, 0, 0, 300, 600, 9000, 0); m_CanonPlasma = new Defense("Canon Plasma", 0, false, 0, 0, 0, 4000, 500, 95000, 0); m_CanonGauss = new Defense("Canon Gauss", 0, false, 0, 0, 0, 1150, 250, 35000, 0); m_ChampDeForce = new Defense("Champ de Force", 0, false, 0, 0, 0, 1, 10000, 10000, 0); m_MissileInter = new Defense("Missile Interplanetaire", 0, false, 0, 0, 0, 15000, 1, 18000, 0); m_ContreMesure = new Defense("Contre Mesure de defense", 0, false, 0, 0, 0, 1, 1, 6000, 0); m_PlateFormeSpatiale = false; #endregion #region File de Construction m_FConstruction = new Queue<m_ObjetConstruction>(); m_FChantier = new Queue<m_ObjetConstruction>(); m_ordreChantier = new Queue<string>(); m_FTechnologie = new Queue<m_ObjetConstruction>(); #endregion m_secondes = 0; m_minutes = 0; m_heures = 0; m_jours = 0; #region Listes Batiments - Defenses - Technologies - Vaisseaux #region Batiments Batiment[] m_ListeBatiments = new Batiment[] { m_MineCrystal,m_SiloCrystal, m_MineMetal,m_SiloMetal, m_MineUranium,m_SiloUranium, m_Usine, m_UsineNano, m_ChantierSpatial, m_Terraformeur, m_CentraleEnergie, m_CentraleNucleraire, m_CentreTechnique, m_Convertisseur, m_HangardMissile }; #endregion #region Defenses Batiment[] m_ListeDefense = new Batiment[] { m_CanonLaser,m_CanonIon, m_ChampDeForce, m_CanonPlasma, m_CanonGauss, m_ContreMesure, m_MissileInter }; #endregion #region Technologies Technologie[] m_ListeTechnologies = new Technologie[] { m_Laser, m_Ion, m_Plasma, m_Propulsion, m_Hyperespace, m_PropulsionPoussee, m_Espionage, m_Crystalisateur, m_StationDeForage, m_StabilisationIsotopique, m_Blindage, m_Armement, m_Bouclier, m_CoordinationDesCentres, m_CoordinationDesFlottes, m_CoordinationDesPlanetes, m_Planetarion, }; #endregion #region Vaisseaux Vaisseaux[] m_ListeVaisseaux = new Vaisseaux[] { m_NavLeg, m_NavLrd, m_Chasseur, m_Escorteur, m_Frégate, m_Destroyer, m_Croiseur, m_Forteresse, m_BatAmiral, m_SatSol, m_Collecteur, m_SondeEspion }; #endregion #endregion }