/// <summary> /// Adds a new <see cref="TieredUpgradeHandler{T}" /> to the collection, with all necessary default events created.<para/> /// Use this for upgrades where only the highest tier is counted, no matter how many different tiers are equipped. /// </summary> /// <param name="techType">The TechType of the upgrade module.</param> /// <param name="tieredValue">The tiered value this upgrade module represents.</param> /// <returns>The newly created <see cref="TieredUpgradeHandler{T}"/> instance.</returns> public TieredUpgradeHandler <T> CreateTier(TechType techType, T tieredValue) { var tieredUpgrade = new TieredUpgradeHandler <T>(techType, tieredValue, this) { MaxCount = this.MaxCount }; collection.Add(tieredUpgrade); return(tieredUpgrade); }
/// <summary> /// Get the value assigned to the specified tier techtype. /// </summary> /// <param name="techType">The TechTech to check.</param> /// <returns>The <see cref="{T}"/> value associated to the tier if found; Otherwise returns <see cref="DefaultValue"/>.</returns> public T TierValue(TechType tierId) { TieredUpgradeHandler <T> tier = collection.Find(t => t.TechType == tierId); if (tier != null) { return(tier.TieredValue); } return(DefaultValue); }