当前位置: 首页>>代码示例>>C#>>正文


C# Part.FindModuleImplementing方法代码示例

本文整理汇总了C#中Part.FindModuleImplementing方法的典型用法代码示例。如果您正苦于以下问题:C# Part.FindModuleImplementing方法的具体用法?C# Part.FindModuleImplementing怎么用?C# Part.FindModuleImplementing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Part的用法示例。


在下文中一共展示了Part.FindModuleImplementing方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ModuleWheelBaseAdaptor

 public ModuleWheelBaseAdaptor(Part part)
 {
     _moduleWheelBase = part.FindModuleImplementing<ModuleWheelBase>();
     _moduleWheelMotor = part.FindModuleImplementing<ModuleWheelMotor>();
     _moduleWheelMotorSteering = part.FindModuleImplementing<ModuleWheelMotorSteering>();
     _moduleWheelDamage = part.FindModuleImplementing<ModuleWheelDamage>();
 }
开发者ID:pizzaoverhead,项目名称:WheelSounds,代码行数:7,代码来源:ModuleWheelBaseAdaptor.cs

示例2: FindThermalSource

        public static ThermalSourceSearchResult FindThermalSource(Part currentpart, Func<IThermalSource, bool> condition, int stackdepth, int parentdepth, bool skipSelfContained )
        {
            if (stackdepth == 0)
            {
                var thermalsources = currentpart.FindModulesImplementing<IThermalSource>().Where(condition);

                var source = skipSelfContained ? thermalsources.FirstOrDefault(s => !s.IsSelfContained) : thermalsources.FirstOrDefault();
                if (source != null)
                    return new ThermalSourceSearchResult(source, 0);
                else
                    return null;
            }

            var thermalcostModifier = currentpart.FindModuleImplementing<ThermalPowerTransport>();

            float stackDepthCost = thermalcostModifier != null ? thermalcostModifier.thermalCost : 1;

            foreach (var attachNodes in currentpart.attachNodes.Where(atn => atn.attachedPart != null))
            {
                var source = FindThermalSource(attachNodes.attachedPart, condition, (stackdepth - 1), parentdepth, skipSelfContained);

                if (source != null)
                    return source.IncreaseCost(stackDepthCost);
            }

            if (parentdepth > 0 && currentpart.parent != null)
            {
                var source = FindThermalSource(currentpart.parent, condition, (stackdepth - 1), (parentdepth - 1), skipSelfContained);

                if (source != null)
                    return source.IncreaseCost(2f);
            }

            return null;
        }
开发者ID:Kerbas-ad-astra,项目名称:KSPInterstellar,代码行数:35,代码来源:ThermalSourceSearchResult.cs

示例3: PartUnpacked

        public void PartUnpacked(Part part)
        {
            if (HighLogic.LoadedSceneIsFlight == false)
                return;

            WBIExtractionMonitor extractionMonitor = null;

            if (part.FindModuleImplementing<ModuleResourceHarvester>() == null)
                return;

            //Add an extraction monitor if needed.
            extractionMonitor = part.FindModuleImplementing<WBIExtractionMonitor>();
            if (extractionMonitor == null)
            {
                extractionMonitor = (WBIExtractionMonitor)part.AddModule("WBIExtractionMonitor");
                extractionMonitor.OnActive();
                extractionMonitor.OnStart(PartModule.StartState.Landed);
                extractionMonitor = null;
            }
        }
开发者ID:PalverZ,项目名称:Pathfinder,代码行数:20,代码来源:WBIDrillManager.cs

示例4: SetNewSection

 private static void SetNewSection(Part part, string oldSectionName, string newSectionName)
 {
     var section = part.FindModuleImplementing<SectionInfo>();
     if(section?.section == oldSectionName)
     {
         section.section = newSectionName;
         foreach (var child in part.children)
         {
             SetNewSection(child, oldSectionName, newSectionName);
         }
     }
 }
开发者ID:jkoritzinsky,项目名称:ShipSections,代码行数:12,代码来源:SectionSplitter.cs

示例5: AttachCollector

        void AttachCollector(Part toPart) {
            toPart.AddModule("ModuleExhaustCapture");

            ModuleExhaustCapture newModule = toPart.FindModuleImplementing<ModuleExhaustCapture>();
            ModuleResource outPutRes = new ModuleResource();
            
            if (primaryResourceName != null && primaryResourceRate != 0 && PartResourceLibrary.Instance.resourceDefinitions.Contains(primaryResourceName)) 
            {
           
                outPutRes.name = primaryResourceName;
                outPutRes.id = PartResourceLibrary.Instance.GetDefinition(primaryResourceName).id; //Do I need this       
                outPutRes.rate = primaryResourceRate*thrustMultiplier;
           
                newModule.outputResources.Add(outPutRes);
                print("PZER: Capture " + outPutRes.name + " " + outPutRes.id + " added with a real rate of " + outPutRes.rate * thrustMultiplier);
            }
            else
            {
                 print("PZER: " + part.partName + " has bad primary resource/rate: " + primaryResourceName +" rate: " + primaryResourceRate);
            }

            
            
            if (secondaryResourceName != null && secondaryResourceRate != 0 && PartResourceLibrary.Instance.resourceDefinitions.Contains(secondaryResourceName)) {


                outPutRes.name = secondaryResourceName;
                 
                outPutRes.id = PartResourceLibrary.Instance.GetDefinition(secondaryResourceName).id; //see above       
                outPutRes.rate = secondaryResourceRate * thrustMultiplier;

  
                newModule.outputResources.Add(outPutRes);

                print("PZER: Secondary capture " + outPutRes.name + " " + outPutRes.id + " added with a real rate of " + outPutRes.rate * thrustMultiplier);
            }
            else
            
            {
                print("PZER: " + part.partName + " has bad secondary resource/rate: " + secondaryResourceName + " rate: " + secondaryResourceRate);
            }


            

            newModule.heatIncrease = (float)additionalHeatRate;



        }
开发者ID:PalverZ,项目名称:PalverZExhaustRecycler,代码行数:50,代码来源:ExhuastRecycler.cs

示例6: EditorPartEvent

        private void EditorPartEvent(ConstructionEventType data0, Part data1)
        {
            var sectionInfo = data1.FindModuleImplementing<SectionInfo>();
            if (data0 == ConstructionEventType.PartDetached)
            {
                CopySectionDataToOtherPartInSection(sectionInfo, true);
            }
            if (data0 == ConstructionEventType.PartCreated && data1 == EditorLogic.RootPart)
            {
                LogFormatted_DebugOnly("Initializing root section.");
                sectionInfo.isSectionRoot = true;
                sectionInfo.InitializeAsNewSection();
            }
            if(data0 == ConstructionEventType.PartAttached)
            {
                sectionInfo.TrySetSectionBasedOnParent();
                if (EditorLogic.fetch.symmetryMode != 1 && sectionInfo.isSectionRoot)
                    EnsureOnlyOneSectionRoot(sectionInfo);

            }
        }
开发者ID:jkoritzinsky,项目名称:ShipSections,代码行数:21,代码来源:ShipSectionsEditorAssist.cs

示例7: IsARadialDecoupler

 private static bool IsARadialDecoupler(Part part)
 {
     return part.HasModule<ModuleAnchoredDecoupler>() ||
         part.FindModuleImplementing<ModuleDecouple>()?.explosiveNodeID == "srf";
 }
开发者ID:jkoritzinsky,项目名称:Extensive-Engineer-Report,代码行数:5,代码来源:RadialStagesStrutted.cs

示例8: OnReferenceTransfomPartChange

        // Psuedo-event from checking Update()
        private void OnReferenceTransfomPartChange(Part part)
        {
            Log.Trace("Entering PlaneMode.OnReferenceTransfomPartChange()");
            Log.Debug("ReferenceTransformPart has changed");

            if (part != null)
            {
                Log.Debug("part is not null, finding ModulePlaneMode on: " + part.partInfo.title);
                var modulePlaneMode = part.FindModuleImplementing<ModulePlaneMode>();

                if (modulePlaneMode != null)
                {
                    Log.Debug("Found ModulePlaneMode, updating _currentModulePlaneMode and calling SetControlMode()");

                    _currentModulePlaneMode = modulePlaneMode;
                    SetControlMode(_currentModulePlaneMode.ControlMode);
                }
            }
            else
            {
                Log.Debug("part is null, updating _currentModulePlaneMode");
                _currentModulePlaneMode = null;
            }

            Log.Trace("Leaving PlaneMode.OnReferenceTransfomPartChange()");
        }
开发者ID:Kerbas-ad-astra,项目名称:PlaneMode,代码行数:27,代码来源:PlaneMode.cs

示例9: force_occlusion_update

 public static void force_occlusion_update(Part p, bool overwrite = false)
 {
     if (p == null)
         return;
     if (!p.DragCubes.None)
     {
         ModuleParachute mp = p.FindModuleImplementing<ModuleParachute>();
         if (mp != null)
         {
             p.DragCubes.SetCubeWeight("PACKED", 1.0f);
             p.DragCubes.SetCubeWeight("SEMIDEPLOYED", 0.0f);
             p.DragCubes.SetCubeWeight("DEPLOYED", 0.0f);
             p.DragCubes.SetOcclusionMultiplier(1.0f);
         }
         if (overwrite)
             p.DragCubes.ForceUpdate(true, true);
         p.DragCubes.SetDragWeights();
         p.DragCubes.RequestOcclusionUpdate();
         p.DragCubes.SetPartOcclusion();
     }
 }
开发者ID:Boris-Barboris,项目名称:CorrectCoL,代码行数:21,代码来源:CoLMarkerFull.cs


注:本文中的Part.FindModuleImplementing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。