Пример #1
0
        public void TechUnlockEvent(GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> ev)
        {
            if (!KCT_GameStates.settings.enabledForSave)
            {
                return;
            }
            if (ev.target == RDTech.OperationResult.Successful)
            {
                KCT_TechItem tech = new KCT_TechItem(ev.host);
                if (!KCT_GameStates.settings.InstantTechUnlock && !KCT_GameStates.settings.DisableBuildTime)
                {
                    tech.DisableTech();
                }
                if (!tech.isInList())
                {
                    ++KCT_GameStates.TotalUpgradePoints;
                    var message = new ScreenMessage("[KCT] Upgrade Point Added!", 4.0f, ScreenMessageStyle.UPPER_LEFT);
                    ScreenMessages.PostScreenMessage(message, true);

                    if (!KCT_GameStates.settings.InstantTechUnlock && !KCT_GameStates.settings.DisableBuildTime)
                    {
                        KCT_GameStates.TechList.Add(tech);
                        message = new ScreenMessage("[KCT] Node will unlock in " + KCT_Utilities.GetFormattedTime(tech.TimeLeft), 4.0f, ScreenMessageStyle.UPPER_LEFT);
                        ScreenMessages.PostScreenMessage(message, true);
                    }
                }
                else
                {
                    ResearchAndDevelopment.Instance.Science += tech.scienceCost;
                    var message = new ScreenMessage("[KCT] This node is already being researched!", 4.0f, ScreenMessageStyle.UPPER_LEFT);
                    ScreenMessages.PostScreenMessage(message, true);
                }
            }
        }
Пример #2
0
        public KCT_TechStorageItem FromTechItem(KCT_TechItem techItem)
        {
            this.techName    = techItem.techName;
            this.techID      = techItem.techID;
            this.progress    = techItem.progress;
            this.scienceCost = techItem.scienceCost;

            return(this);
        }
Пример #3
0
 public override void OnDecodeFromConfigNode()
 {
     base.OnDecodeFromConfigNode();
     KCT_GameStates.TechList.Clear();
     foreach (KCT_TechStorageItem tSI in this.techBuildList)
     {
         KCT_TechItem tI = tSI.ToTechItem();
         KCT_GameStates.TechList.Add(tI);
     }
 }
Пример #4
0
        public void TechUnlockEvent(GameEvents.HostTargetAction<RDTech, RDTech.OperationResult> ev)
        {
            if (!KCT_GameStates.settings.enabledForSave) return;
            if (ev.target == RDTech.OperationResult.Successful)
            {
                KCT_TechItem tech = new KCT_TechItem(ev.host);
                if (!KCT_GameStates.settings.InstantTechUnlock && !KCT_GameStates.settings.DisableBuildTime) tech.DisableTech();
                if (!tech.isInList())
                {
                    ++KCT_GameStates.TotalUpgradePoints;
                    var message = new ScreenMessage("[KCT] Upgrade Point Added!", 4.0f, ScreenMessageStyle.UPPER_LEFT);
                    ScreenMessages.PostScreenMessage(message, true);

                    if (!KCT_GameStates.settings.InstantTechUnlock && !KCT_GameStates.settings.DisableBuildTime)
                    {
                        KCT_GameStates.TechList.Add(tech);
                        message = new ScreenMessage("[KCT] Node will unlock in " + KCT_Utilities.GetFormattedTime(tech.TimeLeft), 4.0f, ScreenMessageStyle.UPPER_LEFT);
                        ScreenMessages.PostScreenMessage(message, true);
                    }
                }
                else
                {
                    ResearchAndDevelopment.Instance.Science += tech.scienceCost;
                    var message = new ScreenMessage("[KCT] This node is already being researched!", 4.0f, ScreenMessageStyle.UPPER_LEFT);
                    ScreenMessages.PostScreenMessage(message, true);
                }
            }
        }
Пример #5
0
        public KCT_TechItem ToTechItem()
        {
            KCT_TechItem ret = new KCT_TechItem(techID, techName, progress, scienceCost);

            return(ret);
        }
Пример #6
0
        public static void ProgressBuildTime()
        {
            UT = Planetarium.GetUniversalTime();
            double UTDiff = UT - lastUT;

            if (UTDiff > 0 && UTDiff < (TimeWarp.fetch.warpRates[TimeWarp.fetch.warpRates.Length - 1] * 2) && lastUT > 0)
            {
                double buildRate = 0;
                if (KCT_GameStates.VABList.Count > 0)
                {
                    for (int i = 0; i < KCT_GameStates.VABList.Count; i++)
                    {
                        buildRate = GetBuildRate(i, KCT_BuildListVessel.ListType.VAB);
                        KCT_GameStates.VABList[i].AddProgress(buildRate * (UT - lastUT));
                        if (((IKCTBuildItem)KCT_GameStates.VABList[i]).IsComplete())
                        {
                            MoveVesselToWarehouse(0, i);
                        }
                    }
                }
                if (KCT_GameStates.SPHList.Count > 0)
                {
                    for (int i = 0; i < KCT_GameStates.SPHList.Count; i++)
                    {
                        buildRate = GetBuildRate(i, KCT_BuildListVessel.ListType.SPH);
                        KCT_GameStates.SPHList[i].AddProgress(buildRate * (UT - lastUT));
                        if (((IKCTBuildItem)KCT_GameStates.SPHList[i]).IsComplete())
                        {
                            MoveVesselToWarehouse(1, i);
                        }
                    }
                }

                for (int i = 0; i < KCT_GameStates.TechList.Count; i++)
                {
                    KCT_TechItem tech = KCT_GameStates.TechList[i];
                    buildRate      = tech.BuildRate;
                    tech.progress += (buildRate * (UT - lastUT));
                    if (tech.isComplete || KCT_GameStates.settings.InstantTechUnlock)
                    {
                        if (KCT_GameStates.settings.ForceStopWarp && TimeWarp.CurrentRate > 1f)
                        {
                            TimeWarp.SetRate(0, true);
                        }
                        if (tech.protoNode == null)
                        {
                            continue;
                        }
                        tech.EnableTech();
                        KCT_GameStates.TechList.Remove(tech);
                    }
                }

                if (KCT_GameStates.LaunchPadReconditioning != null)
                {
                    IKCTBuildItem item = (IKCTBuildItem)KCT_GameStates.LaunchPadReconditioning;
                    KCT_GameStates.LaunchPadReconditioning.progress += (item.GetBuildRate() * (UT - lastUT));
                    if (item.IsComplete() || !KCT_GameStates.settings.Reconditioning)
                    {
                        KCT_GameStates.LaunchPadReconditioning = null;
                    }
                }
            }
            lastUT = UT;
        }
Пример #7
0
 public KCT_TechItem ToTechItem()
 {
     KCT_TechItem ret = new KCT_TechItem(techID, techName, progress, scienceCost);
     return ret;
 }
Пример #8
0
        public KCT_TechStorageItem FromTechItem(KCT_TechItem techItem)
        {
            this.techName = techItem.techName;
            this.techID = techItem.techID;
            this.progress = techItem.progress;
            this.scienceCost = techItem.scienceCost;

            return this;
        }