public void setUniverseGenerator(Game game, FleetController fleetController, PlanetController planetController, ShipDesigner shipDesigner, TechStore techStore) { this.game.setGame(game); this.fleetController = fleetController; this.planetController = planetController; this.shipDesigner = shipDesigner; this.techStore = techStore; }
/** * Initialize the Player techs with the tech store */ public void init(Player player, TechStore techStore) { engines = new List <TechEngine>(); scanners = new List <TechHullComponent>(); shields = new List <TechHullComponent>(); armor = new List <TechHullComponent>(); torpedos = new List <TechHullComponent>(); beamWeapons = new List <TechHullComponent>(); hulls = new List <TechHull>(); starbases = new List <TechHull>(); planetaryScanners = new List <TechPlanetaryScanner>(); defenses = new List <TechDefence>(); techsForCategory = new Dictionary <TechCategory, List <Tech> >(); hullComponents = new List <TechHullComponent>(); bestEngine = addPlayerTechs(player, techStore.getAllEngines(), engines); bestScanner = addPlayerTechs(player, techStore.getAllScanners(), scanners); bestShield = addPlayerTechs(player, techStore.getAllShields(), shields); bestArmor = addPlayerTechs(player, techStore.getAllArmor(), armor); bestTorpedo = addPlayerTechs(player, techStore.getAllTorpedos(), torpedos); bestBeamWeapon = addPlayerTechs(player, techStore.getAllBeamWeapons(), beamWeapons); bestHull = addPlayerTechs(player, techStore.getAllHulls(), hulls); bestStarbase = addPlayerTechs(player, techStore.getAllStarbases(), starbases); bestPlanetaryScanner = addPlayerTechs(player, techStore.getAllPlanetaryScanners(), planetaryScanners); bestDefense = addPlayerTechs(player, techStore.getAllDefenses(), defenses); foreach (TechCategory category in Enum.GetValues(typeof(TechCategory))) { techsForCategory.Add(category, new List <Tech>()); } foreach (Tech tech in techStore.getAll()) { if (player.hasTech(tech)) { List <Tech> t = techsForCategory[tech.getCategory()]; t.Add(tech); if (tech is TechHullComponent) { hullComponents.Add((TechHullComponent)tech); } } } foreach (TechCategory category in Enum.GetValues(typeof(TechCategory))) { techsForCategory[category] = techsForCategory[category].OrderBy(t => t.getRanking()).ToList <Tech>(); } hullComponents = hullComponents.OrderBy(t => t.getRanking()).ToList <TechHullComponent>(); }