Esempio n. 1
0
        private static void LoadPadNamesAndCosts()
        {
            KCT_LaunchPad lp           = KCTGameStates.ActiveKSC.ActiveLPInstance;
            var           list         = lp.GetUpgradeableFacilityReferences();
            var           upgdFacility = list[0];
            var           padUpgdLvls  = upgdFacility.UpgradeLevels;

            _padLvlOptions = new string[padUpgdLvls.Length];
            _padCosts      = new double[padUpgdLvls.Length];

            for (int i = 0; i < padUpgdLvls.Length; i++)
            {
                float limit  = GameVariables.Instance.GetCraftMassLimit((float)i / (float)upgdFacility.MaxLevel, true);
                var   sLimit = limit == float.MaxValue ? "unlimited" : $"max {limit} tons";
                _padLvlOptions[i] = $"Level {i + 1} ({sLimit})";

                if (i > 0)
                {
                    var lvl = padUpgdLvls[i];
                    _padCosts[i] = _padCosts[i - 1] + lvl.levelCost;
                }
                else
                {
                    // Use the KCT formula for determining the cost of first level
                    _padCosts[0] = _costOfNewLP;
                }
            }
        }
Esempio n. 2
0
        public static void CreateNewPad(string padName, int padLevel)
        {
            KCT_LaunchPad lp = ActiveKSC.ActiveLPInstance;

            if (lp.GetUpgradeableFacilityReferences()?[0]?.UpgradeLevels is UpgradeableObject.UpgradeLevel[] padUpgdLvls)
            {
                padLevel = UnityEngine.Mathf.Clamp(padLevel, 1, padUpgdLvls.Length);
                ActiveKSC.LaunchPads.Add(new KCT_LaunchPad(padName, padLevel));
            }
        }