本文整理汇总了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;
}
示例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);
}
}
示例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();
}