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


C# LinkType.GetJointStrength方法代码示例

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


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

示例1: CreateJoint

 public void CreateJoint(Rigidbody originBody, Rigidbody targetBody, LinkType type, Vector3 anchorPosition)
 {
     if (HighLogic.LoadedSceneIsFlight && this.part != null && this.part.attachJoint != null && this.part.attachJoint.Joint != null)
     {
         this.part.attachJoint.Joint.breakForce = Mathf.Infinity;
         this.part.attachJoint.Joint.breakTorque = Mathf.Infinity;
         if (!this.IsFreeAttached && this.Target != null && this.Target.part != null && this.Target.part.attachJoint != null && this.Target.part.attachJoint.Joint != null)
         {
             this.Target.part.attachJoint.Joint.breakForce = Mathf.Infinity;
             this.Target.part.attachJoint.Joint.breakTorque = Mathf.Infinity;
         }
     }
     var breakForce = type.GetJointStrength();
     this.LinkType = type;
     if (!this.IsFreeAttached)
     {
         var moduleActiveStrut = this.Target;
         if (moduleActiveStrut != null)
         {
             moduleActiveStrut.LinkType = type;
             this.IsOwnVesselConnected = moduleActiveStrut.vessel == this.vessel;
         }
     }
     else
     {
         this.IsOwnVesselConnected = this.FreeAttachPart.vessel == this.vessel;
     }
     if (!this.IsEnforced || Config.Instance.GlobalJointWeakness)
     {
         this._joint = originBody.gameObject.AddComponent<ConfigurableJoint>();
         this._joint.connectedBody = targetBody;
         this._joint.breakForce = this._joint.breakTorque = breakForce;
         this._joint.xMotion = ConfigurableJointMotion.Locked;
         this._joint.yMotion = ConfigurableJointMotion.Locked;
         this._joint.zMotion = ConfigurableJointMotion.Locked;
         this._joint.angularXMotion = ConfigurableJointMotion.Locked;
         this._joint.angularYMotion = ConfigurableJointMotion.Locked;
         this._joint.angularZMotion = ConfigurableJointMotion.Locked;
         this._joint.projectionAngle = 0f;
         this._joint.projectionDistance = 0f;
         this._joint.anchor = anchorPosition;
     }
     else
     {
         this._manageAttachNode(breakForce);
     }
     this.PlayAttachSound();
 }
开发者ID:BobPalmer,项目名称:KSP-Active-Struts,代码行数:48,代码来源:ModuleActiveStrut.cs


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