本文整理汇总了C#中TimeSpan.ToUnixStyleTime方法的典型用法代码示例。如果您正苦于以下问题:C# TimeSpan.ToUnixStyleTime方法的具体用法?C# TimeSpan.ToUnixStyleTime怎么用?C# TimeSpan.ToUnixStyleTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeSpan
的用法示例。
在下文中一共展示了TimeSpan.ToUnixStyleTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPositionAtUT
/// <summary>
/// Get the position of this thing in this orbit at the given
/// time. Note that it does NOT take into account any
/// encounters or manuever nodes - it assumes the current
/// orbit patch remains followed forever.
/// </summary>
/// <param name="timeStamp">The universal time to query for</param>
/// <returns></returns>
public Vector GetPositionAtUT( TimeSpan timeStamp )
{
return new Vector( orbit.getPositionAtUT( timeStamp.ToUnixStyleTime() ) - shared.Vessel.GetWorldPos3D() );
}
示例2: GetVelocityAtUT
/// <summary>
/// Get the velocity pairing of this thing in this orbit at the given
/// time. Note that it does NOT take into account any
/// encounters or manuever nodes - it assumes the current
/// orbit patch remains followed forever.
/// </summary>
/// <param name="timeStamp">The universal time to query for</param>
/// <returns></returns>
public OrbitableVelocity GetVelocityAtUT( TimeSpan timeStamp )
{
var orbVel = new Vector( orbit.getOrbitalVelocityAtUT( timeStamp.ToUnixStyleTime() ) );
// For some weird reason orbit returns velocities with Y and Z swapped, so flip them back:
orbVel = new Vector( orbVel.X, orbVel.Z, orbVel.Y );
CelestialBody parent = orbit.referenceBody;
Vector surfVel;
if (parent != null)
{
Vector3d pos = GetPositionAtUT( timeStamp ).ToVector3D();
surfVel = new Vector( orbVel - parent.getRFrmVel( pos + shared.Vessel.GetWorldPos3D()) );
}
else
surfVel = new Vector( orbVel.X, orbVel.Y, orbVel.Z );
return new OrbitableVelocity( orbVel, surfVel );
}