コード例 #1
0
        public void reClassifyingAllGundam00()
        {
            this.resetStatistics();

            foreach (Part p in part.vessel.Parts)
            {
                foreach (PartModule m in p.Modules)
                {
                    switch (m.moduleName)
                    {
                    case "GNDrive":
                    {
                        GNDrive drive = (GNDrive)m;
                        driveList.Add(drive);
                        gundam00PartSet.Add(drive.GetInstanceID());
                        break;
                    }

                    case "GNEngine":
                    {
                        GNEngine engine = (GNEngine)m;
                        engineList.Add(engine);
                        gundam00PartSet.Add(engine.GetInstanceID());
                        break;
                    }

                    case "GNRcs":
                    {
                        GNRcs rcs = (GNRcs)m;
                        rcsList.Add(rcs);
                        gundam00PartSet.Add(rcs.GetInstanceID());
                        break;
                    }

                    case "GNTDBlanket":
                    {
                        GNTDBlanket TDBlanket = (GNTDBlanket)m;
                        //rcsList.Add(rcs);
                        gundam00PartSet.Add(TDBlanket.GetInstanceID());
                        break;
                    }
                    }
                }
            }
        }
コード例 #2
0
        private void restore(float percent)
        {
            List <GNDrive> GNDriveList = new List <GNDrive>();

            foreach (Part p in this.vessel.Parts)
            {
                foreach (PartModule m in p.Modules)
                {
                    if (m.moduleName == "GNDrive")
                    {
                        GNDrive drive = (GNDrive)m;
                        GNDriveList.Add(drive);
                    }
                }
            }

            int   count        = GNDriveList.Count;
            float restoneCount = percent;

            bool flag = true;

            while (flag)
            {
                flag = false;

                float currectRestoneCount = restoneCount;

                foreach (GNDrive drive in GNDriveList)
                {
                    float restoneLast = 0;
                    flag |= drive.restoreGenerateEfficiency(currectRestoneCount / count, out restoneLast);

                    restoneCount -= restoneLast;
                }
            }
        }