private IList<ActiveCountermeasureStat> __CreateAvailableActiveCountermeasureStats(int quantity) { IList<ActiveCountermeasureStat> statsList = new List<ActiveCountermeasureStat>(quantity); for (int i = 0; i < quantity; i++) { string name = string.Empty; RangeCategory rangeCat = Enums<RangeCategory>.GetRandom(excludeDefault: true); WDVStrength[] interceptStrengths; float interceptAccuracy; float reloadPeriod; var damageMitigationCategory = Enums<DamageCategory>.GetRandom(excludeDefault: true); float damageMitigationValue = UnityEngine.Random.Range(1F, 2F); switch (rangeCat) { case RangeCategory.Short: name = "CIWS"; interceptStrengths = new WDVStrength[] { new WDVStrength(WDVCategory.Projectile, 0.2F), new WDVStrength(WDVCategory.Missile, 0.5F) }; interceptAccuracy = 0.50F; reloadPeriod = 0.1F; break; case RangeCategory.Medium: name = "AvengerADS"; interceptStrengths = new WDVStrength[] { new WDVStrength(WDVCategory.Missile, 3.0F) }; interceptAccuracy = 0.80F; reloadPeriod = 2.0F; break; case RangeCategory.Long: name = "PatriotADS"; interceptStrengths = new WDVStrength[] { new WDVStrength(WDVCategory.Missile, 1.0F) }; interceptAccuracy = 0.70F; reloadPeriod = 3.0F; break; case RangeCategory.None: default: throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(rangeCat)); } DamageStrength damageMitigation = new DamageStrength(damageMitigationCategory, damageMitigationValue); var countermeasureStat = new ActiveCountermeasureStat(name, AtlasID.MyGui, TempGameValues.AnImageFilename, "Description...", 0F, 0F, 0F, 0F, rangeCat, interceptStrengths, interceptAccuracy, reloadPeriod, damageMitigation); statsList.Add(countermeasureStat); } return statsList; }
/// <summary> /// Initializes a new instance of the <see cref="ActiveCountermeasure"/> class. /// </summary> /// <param name="stat">The stat.</param> /// <param name="name">The optional unique name for this equipment. If not provided, the name embedded in the stat will be used.</param> public ActiveCountermeasure(ActiveCountermeasureStat stat, string name = null) : base(stat, name) { _gameTime = GameTime.Instance; _qualifiedThreats = new List<IInterceptableOrdnance>(); }