public StationData(StationDesignData data) { designData = data; DisplayName = designData.Design.Name; //Add Fighters foreach (KeyValuePair <FighterDefinition, int> keyVal in designData.Fighters) { Fighters.Add(new FighterComplement(keyVal.Key, keyVal.Value)); } foreach (KeyValuePair <FighterDefinition, int> keyVal in designData.HeavyFighters) { HeavyFighters.Add(new FighterComplement(keyVal.Key, keyVal.Value)); } foreach (KeyValuePair <FighterDefinition, int> keyVal in designData.AssaultPods) { AssaultPods.Add(new FighterComplement(keyVal.Key, keyVal.Value)); } ammo = designData.Ammo; ammoMax = designData.Ammo; power = designData.PowerStorage; powerMax = designData.PowerStorage; crew = designData.Crew; crewMax = designData.Crew; troops = designData.Troops; troopsMax = designData.Troops; powerGenerated = designData.PowerGenerated; research = designData.Research; mining = designData.Mining; repair = designData.Repair; ammoGenerated = designData.AmmoGenerated; transporter = designData.Transporter; medical = designData.Medical; boardingDefense = designData.BoardingDefense; diplomacy = designData.Diplomacy; sensor = designData.Sensor; longRangeSensor = designData.LongRangeSensor; advancedSensor = designData.AdvancedSensor; health = designData.Health; healthMax = designData.Health; armorHealth = designData.ArmorHealth; armorHealthMax = designData.ArmorHealth; armorRating = designData.ArmorRating; shieldHealth = designData.ShieldHealth; shieldHealthMax = designData.ShieldHealth; shieldRating = designData.ShieldRating; shieldRechargeRate = designData.ShieldRechargeRate; shieldRechargeDelay = designData.ShieldRechargeDelay; SetCrewEffeciency(); foreach (SavedWeapon savedWeapon in designData.Weapons) { Weapons.Add(new AttachedWeapon(savedWeapon.weapon)); } }
public ShipData(ShipDesignData shipDesignData) { designData = shipDesignData; DisplayName = designData.Design.Name; ForeSection = new ShipQuadrant(this, designData.ForeQuadrant, QuadrantTypes.Fore); AftSection = new ShipQuadrant(this, designData.AftQuadrant, QuadrantTypes.Aft); StarboardSection = new ShipQuadrant(this, designData.StarboardQuadrant, QuadrantTypes.Starboard); PortSection = new ShipQuadrant(this, designData.PortQuadrant, QuadrantTypes.Port); CenterSection = new ShipQuadrant(this, designData.CenterQuadrant, QuadrantTypes.Center); //Add Fighters foreach (KeyValuePair <FighterDefinition, int> keyVal in shipDesignData.Fighters) { Fighters.Add(new FighterComplement(keyVal.Key, keyVal.Value)); } foreach (KeyValuePair <FighterDefinition, int> keyVal in shipDesignData.HeavyFighters) { HeavyFighters.Add(new FighterComplement(keyVal.Key, keyVal.Value)); } foreach (KeyValuePair <FighterDefinition, int> keyVal in shipDesignData.AssaultPods) { AssaultPods.Add(new FighterComplement(keyVal.Key, keyVal.Value)); } fuelMax = designData.Fuel; fuel = fuelMax; ammo = designData.Ammo; ammoMax = designData.Ammo; power = designData.PowerStorage; powerMax = designData.PowerStorage; crew = designData.Crew; crewMax = designData.Crew; supplies = designData.Supplies; suppliesMax = designData.Supplies; troops = designData.Troops; troopsMax = designData.Troops; commandPoints = designData.CommandPoints; mass = designData.Mass; powerGenerated = designData.PowerGenerated; FTLSpeed = designData.FTLSpeed; research = designData.Research; mining = designData.Mining; repair = designData.Repair; ammoGenerated = designData.AmmoGenerated; transporter = designData.Transporter; medical = designData.Medical; cloakingPower = designData.CloakingPower; stealth = designData.Stealth; boardingDefense = designData.BoardingDefense; colonies = designData.Colonies; diplomacy = designData.Diplomacy; sensor = designData.Sensor; longRangeSensor = designData.LongRangeSensor; advancedSensor = designData.AdvancedSensor; CalculateEngines(); AttackDirection = designData.Design.attackDirection; AttackStyle = designData.Design.attackStyle; if (designData.Design.attackRange != -1) { attackRange = designData.Design.attackRange; } else { attackRange = designData.maxRange; } SetCrewEffeciency(); }