public BuildCostDB(BuildCostDB buildCostDB) { BuildTime = buildCostDB.BuildTime; //Struct BuildPointCost = buildCostDB.BuildPointCost; }
public static Entity CreateNewShipClass(Game game, Entity faction, string className = null) { //check className before any to use it in NameDB constructor if (string.IsNullOrEmpty(className)) { ///< @todo source the class name from faction theme. className = "New Class"; // <- Hack for now. } // lets start by creating all the Datablobs that make up a ship class: TODO only need to add datablobs for compoents it has abilites for. var shipInfo = new ShipInfoDB(); var armor = new ArmorDB(); var buildCost = new BuildCostDB(); var cargotype = new CargoAbleTypeDB(); var crew = new CrewDB(); var damage = new DamageDB(); var maintenance = new MaintenanceDB(); var sensorProfile = new SensorProfileDB(); var name = new NameDB(className); name.SetName(faction.Guid, className); var componentInstancesDB = new ComponentInstancesDB(); var massVolumeDB = new MassVolumeDB(); // now lets create a list of all these datablobs so we can create our new entity: List <BaseDataBlob> shipDBList = new List <BaseDataBlob>() { shipInfo, armor, buildCost, cargotype, crew, damage, maintenance, sensorProfile, name, componentInstancesDB, massVolumeDB, }; // now lets create the ship class: Entity shipClassEntity = new Entity(game.GlobalManager, faction.Guid, shipDBList); FactionOwnerDB factionOwner = faction.GetDataBlob <FactionOwnerDB>(); factionOwner.SetOwned(shipClassEntity); // also gets factionDB: FactionInfoDB factionDB = faction.GetDataBlob <FactionInfoDB>(); // and add it to the faction: factionDB.ShipClasses.Add(shipClassEntity); // now lets set some ship info: shipInfo.ShipClassDefinition = Guid.Empty; // just make sure it is marked as a class and not a ship. // now lets add some components: ///< @todo Add ship components // -- basic armour of current faction tech level // -- minimum crew quaters defaulting to 3 months deployment time. // -- a bridge // -- an engineering space // -- a fuel tank // now update the ship system DBs to reflect the components: ///< @todo update ship to reflect added components return(shipClassEntity); }