Example #1
0
        /// <summary>
        /// Adds a new <see cref="TieredUpgradeHandler{T}" /> to the collection, with all default events created.
        /// </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);

            collection.Add(tieredUpgrade);

            return(tieredUpgrade);
        }
        public CrushDepthUpgradesHandler() : base(NoBonusCrushDepth)
        {
            OnFinishedUpgrades += (SubRoot cyclops) =>
            {
                CrushDamage crushDmg = cyclops.gameObject.GetComponent <CrushDamage>();

                crushDmg.SetExtraCrushDepth(this.HighestValue);
            };

            foreach (KeyValuePair <TechType, float> upgrade in SubRoot.hullReinforcement)
            {
                TieredUpgradeHandler <float> tier = CreateTier(upgrade.Key, upgrade.Value);
            }
        }