public void CreateNewColony() { Entity faction = FactionFactory.CreateFaction(_game, "Terran"); StarSystemFactory sysfac = new StarSystemFactory(_game); StarSystem sol = sysfac.CreateSol(_game); //Entity starSystem = Entity.Create(_game.GlobalManager); //Entity planet = Entity.Create(starSystem.Manager, new List<BaseDataBlob>()); List <Entity> solBodies = sol.SystemManager.GetAllEntitiesWithDataBlob <NameDB>(_smAuthToken); Entity planet = solBodies.Find(item => item.GetDataBlob <NameDB>().DefaultName == "Earth"); Entity species = SpeciesFactory.CreateSpeciesHuman(faction, _game.GlobalManager); var requiredDataBlobs = new List <Type>() { typeof(ColonyInfoDB), typeof(NameDB), typeof(InstallationsDB) }; //Entity colony = ColonyFactory.CreateColony(faction, planet); ColonyFactory.CreateColony(faction, species, planet); Entity colony = faction.GetDataBlob <FactionInfoDB>().Colonies[0]; ColonyInfoDB colonyInfoDB = colony.GetDataBlob <ColonyInfoDB>(); //NameDB nameDB = colony.GetDataBlob<NameDB>(); //Assert.IsTrue(HasAllRequiredDatablobs(colony, requiredDataBlobs), "Colony Entity doesn't contains all required datablobs"); Assert.IsTrue(colonyInfoDB.PlanetEntity == planet, "ColonyInfoDB.PlanetEntity refs to wrong entity"); }
public void TestSingleSystemSave() { _game = TestingUtilities.CreateTestUniverse(1); _smAuthToken = new AuthenticationToken(_game.SpaceMaster); StarSystemFactory starsysfac = new StarSystemFactory(_game); StarSystem sol = starsysfac.CreateSol(_game); StaticDataManager.ExportStaticData(sol, "solsave.json"); }
internal TestGame(int numSystems = 10) { GameSettings = new NewGameSettings { GameName = "Unit Test Game", MaxSystems = numSystems, CreatePlayerFaction = false }; Game = new Game(GameSettings); // add a faction: HumanFaction = FactionFactory.CreateFaction(Game, "New Terran Utopian Empire"); // add a species: HumanSpecies = SpeciesFactory.CreateSpeciesHuman(HumanFaction, Game.GlobalManager); // add another faction: GreyAlienFaction = FactionFactory.CreateFaction(Game, "The Grey Empire"); // Add another species: GreyAlienSpecies = SpeciesFactory.CreateSpeciesHuman(GreyAlienFaction, Game.GlobalManager); // Greys Name the Humans. HumanSpecies.GetDataBlob <NameDB>().SetName(GreyAlienFaction.Guid, "Stupid Terrans"); // Humans name the Greys. GreyAlienSpecies.GetDataBlob <NameDB>().SetName(HumanFaction.Guid, "Space bugs"); StarSystemFactory starfac = new StarSystemFactory(Game); Sol = starfac.CreateSol(Game); Earth = NameLookup.GetFirstEntityWithName(Sol, "Earth"); //Sol.Entities[3]; //should be fourth entity created EarthColony = ColonyFactory.CreateColony(HumanFaction, HumanSpecies, Earth); DefaultEngineDesign = DefaultStartFactory.DefaultThrusterDesign(Game, HumanFaction); DefaultWeaponDesign = DefaultStartFactory.DefaultSimpleLaser(Game, HumanFaction); DefaultShipDesign = DefaultStartFactory.DefaultShipDesign(Game, HumanFaction); Vector3 position = Earth.GetDataBlob <PositionDB>().AbsolutePosition_AU; DefaultShip = ShipFactory.CreateShip(DefaultShipDesign, HumanFaction, position, Earth, Sol, "Serial Peacemaker"); Sol.SetDataBlob(DefaultShip.ID, new TransitableDB()); }