private ComponentStatsData(ComponentStatsSerializable serializable, Database database) { ItemId = new ItemId <ComponentStatsData>(serializable.Id, serializable.FileName); Type = serializable.Type; ArmorPoints = new NumericValue <float>(serializable.ArmorPoints, -1000f, 1000f); ArmorRepairRate = new NumericValue <float>(serializable.ArmorRepairRate, -1000f, 1000f); ArmorRepairCooldownModifier = new NumericValue <float>(serializable.ArmorRepairCooldownModifier, -1f, 1f); EnergyPoints = new NumericValue <float>(serializable.EnergyPoints, -1000f, 1000f); EnergyRechargeRate = new NumericValue <float>(serializable.EnergyRechargeRate, -1000f, 1000f); EnergyRechargeCooldownModifier = new NumericValue <float>(serializable.EnergyRechargeCooldownModifier, -1f, 1f); ShieldPoints = new NumericValue <float>(serializable.ShieldPoints, -1000f, 1000f); ShieldRechargeRate = new NumericValue <float>(serializable.ShieldRechargeRate, -1000f, 1000f); ShieldRechargeCooldownModifier = new NumericValue <float>(serializable.ShieldRechargeCooldownModifier, -1f, 1f); Weight = new NumericValue <float>(serializable.Weight, -10000f, 10000f); RammingDamage = new NumericValue <float>(serializable.RammingDamage, 0f, 1000f); EnergyAbsorption = new NumericValue <float>(serializable.EnergyAbsorption, 0f, 1000f); KineticResistance = new NumericValue <float>(serializable.KineticResistance, -1000f, 1000f); EnergyResistance = new NumericValue <float>(serializable.EnergyResistance, -1000f, 1000f); ThermalResistance = new NumericValue <float>(serializable.ThermalResistance, -1000f, 1000f); EnginePower = new NumericValue <float>(serializable.EnginePower, 0f, 20f); TurnRate = new NumericValue <float>(serializable.TurnRate, 0f, 20f); Autopilot = serializable.Autopilot; DroneRangeModifier = new NumericValue <float>(serializable.DroneRangeModifier, -5f, 5f); DroneDamageModifier = new NumericValue <float>(serializable.DroneDamageModifier, -5f, 5f); DroneDefenseModifier = new NumericValue <float>(serializable.DroneDefenseModifier, -5f, 5f); DroneSpeedModifier = new NumericValue <float>(serializable.DroneSpeedModifier, -5f, 5f); DronesBuiltPerSecond = new NumericValue <float>(serializable.DronesBuiltPerSecond, 0f, 10f); DroneBuildTimeModifier = new NumericValue <float>(serializable.DroneBuildTimeModifier, 0f, 10f); WeaponFireRateModifier = new NumericValue <float>(serializable.WeaponFireRateModifier, -1f, 1f); WeaponDamageModifier = new NumericValue <float>(serializable.WeaponDamageModifier, -1f, 1f); WeaponRangeModifier = new NumericValue <float>(serializable.WeaponRangeModifier, -1f, 1f); WeaponEnergyCostModifier = new NumericValue <float>(serializable.WeaponEnergyCostModifier, -1f, 1f); AlterWeaponPlatform = serializable.AlterWeaponPlatform; }
public void Save(ComponentStatsSerializable serializable) { serializable.Type = Type; serializable.ArmorPoints = ArmorPoints.Value; serializable.ArmorRepairRate = ArmorRepairRate.Value; serializable.ArmorRepairCooldownModifier = ArmorRepairCooldownModifier.Value; serializable.EnergyPoints = EnergyPoints.Value; serializable.EnergyRechargeRate = EnergyRechargeRate.Value; serializable.EnergyRechargeCooldownModifier = EnergyRechargeCooldownModifier.Value; serializable.ShieldPoints = ShieldPoints.Value; serializable.ShieldRechargeRate = ShieldRechargeRate.Value; serializable.ShieldRechargeCooldownModifier = ShieldRechargeCooldownModifier.Value; serializable.Weight = Weight.Value; serializable.RammingDamage = RammingDamage.Value; serializable.EnergyAbsorption = EnergyAbsorption.Value; serializable.KineticResistance = KineticResistance.Value; serializable.EnergyResistance = EnergyResistance.Value; serializable.ThermalResistance = ThermalResistance.Value; serializable.EnginePower = EnginePower.Value; serializable.TurnRate = TurnRate.Value; serializable.Autopilot = Autopilot; serializable.DroneRangeModifier = DroneRangeModifier.Value; serializable.DroneDamageModifier = DroneDamageModifier.Value; serializable.DroneDefenseModifier = DroneDefenseModifier.Value; serializable.DroneSpeedModifier = DroneSpeedModifier.Value; serializable.DronesBuiltPerSecond = DronesBuiltPerSecond.Value; serializable.DroneBuildTimeModifier = DroneBuildTimeModifier.Value; serializable.WeaponFireRateModifier = WeaponFireRateModifier.Value; serializable.WeaponDamageModifier = WeaponDamageModifier.Value; serializable.WeaponRangeModifier = WeaponRangeModifier.Value; serializable.WeaponEnergyCostModifier = WeaponEnergyCostModifier.Value; serializable.AlterWeaponPlatform = AlterWeaponPlatform; OnDataSerialized(ref serializable); }
public ComponentStatsSerializable Serialize() { var serializable = new ComponentStatsSerializable(); serializable.Id = ItemId.Id; serializable.FileName = ItemId.Name; serializable.ItemType = (int)ItemType.ComponentStats; serializable.Type = Type; serializable.ArmorPoints = ArmorPoints.Value; serializable.ArmorRepairRate = ArmorRepairRate.Value; serializable.ArmorRepairCooldownModifier = ArmorRepairCooldownModifier.Value; serializable.EnergyPoints = EnergyPoints.Value; serializable.EnergyRechargeRate = EnergyRechargeRate.Value; serializable.EnergyRechargeCooldownModifier = EnergyRechargeCooldownModifier.Value; serializable.ShieldPoints = ShieldPoints.Value; serializable.ShieldRechargeRate = ShieldRechargeRate.Value; serializable.ShieldRechargeCooldownModifier = ShieldRechargeCooldownModifier.Value; serializable.Weight = Weight.Value; serializable.RammingDamage = RammingDamage.Value; serializable.EnergyAbsorption = EnergyAbsorption.Value; serializable.KineticResistance = KineticResistance.Value; serializable.EnergyResistance = EnergyResistance.Value; serializable.ThermalResistance = ThermalResistance.Value; serializable.EnginePower = EnginePower.Value; serializable.TurnRate = TurnRate.Value; serializable.Autopilot = Autopilot; serializable.DroneRangeModifier = DroneRangeModifier.Value; serializable.DroneDamageModifier = DroneDamageModifier.Value; serializable.DroneDefenseModifier = DroneDefenseModifier.Value; serializable.DroneSpeedModifier = DroneSpeedModifier.Value; serializable.DronesBuiltPerSecond = DronesBuiltPerSecond.Value; serializable.DroneBuildTimeModifier = DroneBuildTimeModifier.Value; serializable.WeaponFireRateModifier = WeaponFireRateModifier.Value; serializable.WeaponDamageModifier = WeaponDamageModifier.Value; serializable.WeaponRangeModifier = WeaponRangeModifier.Value; serializable.WeaponEnergyCostModifier = WeaponEnergyCostModifier.Value; serializable.AlterWeaponPlatform = AlterWeaponPlatform; return(serializable); }
private ComponentStats(ComponentStatsSerializable serializable, Database.Loader loader) { Id = new ItemId <ComponentStats>(serializable.Id); loader.AddComponentStats(serializable.Id, this); Type = serializable.Type; ArmorPoints = UnityEngine.Mathf.Clamp(serializable.ArmorPoints, -1000000f, 1000000f); ArmorRepairRate = UnityEngine.Mathf.Clamp(serializable.ArmorRepairRate, -1000000f, 1000000f); ArmorRepairCooldownModifier = UnityEngine.Mathf.Clamp(serializable.ArmorRepairCooldownModifier, -1f, 1f); EnergyPoints = UnityEngine.Mathf.Clamp(serializable.EnergyPoints, -1000000f, 1000000f); EnergyRechargeRate = UnityEngine.Mathf.Clamp(serializable.EnergyRechargeRate, -1000000f, 1000000f); EnergyRechargeCooldownModifier = UnityEngine.Mathf.Clamp(serializable.EnergyRechargeCooldownModifier, -5f, 5f); ShieldPoints = UnityEngine.Mathf.Clamp(serializable.ShieldPoints, -1000000f, 1000000f); ShieldRechargeRate = UnityEngine.Mathf.Clamp(serializable.ShieldRechargeRate, -1000000f, 1000000f); ShieldRechargeCooldownModifier = UnityEngine.Mathf.Clamp(serializable.ShieldRechargeCooldownModifier, -5f, 5f); Weight = UnityEngine.Mathf.Clamp(serializable.Weight, -1000000f, 1000000f); RammingDamage = UnityEngine.Mathf.Clamp(serializable.RammingDamage, -1000000f, 1000000f); EnergyAbsorption = UnityEngine.Mathf.Clamp(serializable.EnergyAbsorption, -1000000f, 1000000f); KineticResistance = UnityEngine.Mathf.Clamp(serializable.KineticResistance, -1000000f, 1000000f); EnergyResistance = UnityEngine.Mathf.Clamp(serializable.EnergyResistance, -1000000f, 1000000f); ThermalResistance = UnityEngine.Mathf.Clamp(serializable.ThermalResistance, -1000000f, 1000000f); EnginePower = UnityEngine.Mathf.Clamp(serializable.EnginePower, 0f, 2000f); TurnRate = UnityEngine.Mathf.Clamp(serializable.TurnRate, 0f, 2000f); Autopilot = serializable.Autopilot; DroneRangeModifier = UnityEngine.Mathf.Clamp(serializable.DroneRangeModifier, -50f, 50f); DroneDamageModifier = UnityEngine.Mathf.Clamp(serializable.DroneDamageModifier, -50f, 50f); DroneDefenseModifier = UnityEngine.Mathf.Clamp(serializable.DroneDefenseModifier, -50f, 50f); DroneSpeedModifier = UnityEngine.Mathf.Clamp(serializable.DroneSpeedModifier, -50f, 50f); DronesBuiltPerSecond = UnityEngine.Mathf.Clamp(serializable.DronesBuiltPerSecond, 0f, 100f); DroneBuildTimeModifier = UnityEngine.Mathf.Clamp(serializable.DroneBuildTimeModifier, 0f, 100f); WeaponFireRateModifier = UnityEngine.Mathf.Clamp(serializable.WeaponFireRateModifier, -100f, 100f); WeaponDamageModifier = UnityEngine.Mathf.Clamp(serializable.WeaponDamageModifier, -100f, 100f); WeaponRangeModifier = UnityEngine.Mathf.Clamp(serializable.WeaponRangeModifier, -100f, 100f); WeaponEnergyCostModifier = UnityEngine.Mathf.Clamp(serializable.WeaponEnergyCostModifier, -100f, 100f); AlterWeaponPlatform = serializable.AlterWeaponPlatform; OnDataDeserialized(serializable, loader); }
public static ComponentStats Create(ComponentStatsSerializable serializable, Database.Loader loader) { return(new ComponentStats(serializable, loader)); }
partial void OnDataDeserialized(ComponentStatsSerializable serializable, Database.Loader loader);
public static ComponentStatsData Deserialize(ComponentStatsSerializable serializable, Database database) { return(new ComponentStatsData(serializable, database)); }
partial void OnDataSerialized(ref ComponentStatsSerializable serializable);
partial void OnDataDeserialized(ComponentStatsSerializable serializable, Database database);