示例#1
0
        public void SetActive()
        {
            try
            {
                EnsureMassAndSizeInitialized();

                KCTDebug.Log($"Switching to LaunchPad: {name} lvl: {level} destroyed? {IsDestroyed}");
                KCTGameStates.ActiveKSC.ActiveLaunchPadID = KCTGameStates.ActiveKSC.LaunchPads.IndexOf(this);

                //set the level to this level
                if (Utilities.CurrentGameIsCareer())
                {
                    UpgradeableFacility facility = GetUpgradeableFacilityReference();
                    KCTEvents.AllowedToUpgrade = true;
                    facility.SetLevel(level);
                }

                //set the destroyed state to this destroyed state
                UpdateLaunchpadDestructionState(false);
            }
            catch (Exception ex)
            {
                KCTDebug.LogError("Error while calling SetActive: " + ex);
            }
        }
示例#2
0
        public override void OnEventCompleted()
        {
            List <UpgradeableFacility> facilitiesToUpgrade = GetFacilityById(facilityId);

            for (int i = 0; i < facilitiesToUpgrade.Count; i++)
            {
                UpgradeableFacility facilityToUpgrade = facilitiesToUpgrade.ElementAt(i);
                if (facilityToUpgrade.FacilityLevel != levelRequested - 1 && Directory.Exists(KSPUtil.ApplicationRootPath + "/GameData/KerbalConstructionTime"))
                {
                    UpgradeHeld = true;
                    kctWarning  = GenerateKctWarning(facilityToUpgrade.FacilityLevel);
                    return;
                }
                facilityToUpgrade.SetLevel(levelRequested);
                UpgradeHeld = false;
            }
            parentFacility.OnUpgradeCompleted();
        }