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


C# Vessel.GoOffRails方法代码示例

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


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

示例1: PlaceSpawnedVessel

        IEnumerator PlaceSpawnedVessel(Vessel v, bool moveVessel)
        {
            loadingCraft = true;
            v.isPersistent = true;
            while(v.packed)
            {
                yield return null;
            }
            v.SetWorldVelocity(Vector3d.zero);

            yield return null;
            FlightGlobals.ForceSetActiveVessel(v);
            yield return null;
            v.Landed = true;
            v.situation = Vessel.Situations.PRELAUNCH;
            v.GoOffRails();

            //Staging.beginFlight();
            StageManager.BeginFlight();

            if(moveVessel)
            {
                VesselMove.instance.StartMove(v, false);
                VesselMove.instance.moveHeight = 35;
                yield return null;
                if(VesselMove.instance.movingVessel == v)
                {
                    v.Landed = false;
                }
            }
            loadingCraft = false;
        }
开发者ID:BahamutoD,项目名称:VesselMover,代码行数:32,代码来源:VesselSpawn.cs

示例2: wait_for_launched_vessel

 IEnumerator<YieldInstruction> wait_for_launched_vessel(Vessel vsl)
 {
     if(vessel.LandedOrSplashed)
     {
         var pos = vsl.transform.position;
         var rot = vsl.transform.rotation;
         while(vsl.packed)
         {
             rot = vsl.transform.rotation;
             pos = vsl.transform.position;
             vsl.GoOffRails();
             if(!vsl.packed) break;
             yield return null;
         }
         vsl.SetPosition(pos);
         vsl.SetRotation(rot);
     }
     else
     {
         var dpos = vsl.orbit.pos-vessel.orbit.pos;
         vsl.orbitDriver.SetOrbitMode(OrbitDriver.UpdateMode.UPDATE);
         while(vsl.packed)
         {
             vsl.orbit.pos = vessel.orbit.pos+dpos;
             vsl.GoOffRails();
             if(!vsl.packed) break;
             yield return null;
         }
         vsl.orbitDriver.SetOrbitMode(OrbitDriver.UpdateMode.TRACK_Phys);
     }
 }
开发者ID:pjslauta,项目名称:hangar,代码行数:31,代码来源:HangarMachinery.cs

示例3: teleportToDockingPort

        // will only work for short distances (ie. less than 50km)
        // will rip the ship into little pieces if the distance is much bigger
        /*static public void teleportToVessel (Vessel vessel, Vessel targetVessel, float d)
        {
            Vector3 j = Util.nextVector3 ().normalized * d;
            Vector3 targetPos = targetVessel.orbit.pos + j;
            Vector3 relPos = targetPos - vessel.orbit.pos;
            if (relPos.magnitude > 50000) {
                UnityEngine.Debug.Log ("TeleporterLite: warning: distance > 50km");
            }

            // teleport & match velocity
            if (vessel.packed == false) {
                UnityEngine.Debug.Log ("teleportToVessel unpacked " + relPos.magnitude.ToString ("F1"));

                vessel.Translate(Util.reorder (relPos, 132));
                vessel.GoOnRails ();
                vessel.orbit.vel = targetVessel.orbit.vel;
                vessel.GoOffRails ();
            } else {
                UnityEngine.Debug.Log ("teleportToVessel packed " + relPos.magnitude.ToString ("F1"));

                vessel.SetPosition(targetVessel.transform.position + j);
                vessel.orbit.vel = targetVessel.orbit.vel;
            }
        }*/
        public static void teleportToDockingPort(Vessel vessel, Part vesselPort, Part targetPort, float distance)
        {
            // check orientation
            Vector3 rp = Vector3.zero;
            Vector3 euler = Vector3.zero;
            float d = 0;
            Util.getDockRelPosAndAtt(vesselPort, targetPort, out rp, out d, out euler);
            float roll = euler.y;
            euler.y = 0;
            if (Util.maxElement (euler) > 5) {
                UnityEngine.Debug.Log ("TeleporterLite: incorrect orientation!");
                return;
            }

            Vector3 dockPos = vesselPort.transform.position + vesselPort.transform.TransformDirection (new Vector3 (0, Util.getDockPosY(targetPort) + 1 + distance, 0));
            Vector3 relDockPos = targetPort.transform.position - dockPos;
            if (relDockPos.magnitude > 500) {
                UnityEngine.Debug.Log ("TeleporterLite: distance > 500m");
                return;
            }

            // teleport
            vessel.Translate(relDockPos);

            // match velocity
            vessel.GoOnRails();
            vessel.orbit.vel = targetPort.vessel.orbit.vel;
            vessel.GoOffRails();
        }
开发者ID:rjohnson72,项目名称:ORDA,代码行数:55,代码来源:Teleporter.cs


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