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


C# Vehicle.GetLastFrameVelocity方法代码示例

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


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

示例1: CheckCollisions

 private ushort CheckCollisions(ushort instanceID, ref CitizenInstance citizenData, Segment3 segment, Vector3 min, Vector3 max, ushort otherID, ref Vehicle otherData, ref Vector3 pushAmount, ref float pushDivider)
 {
     VehicleInfo info = otherData.Info;
     if (info.m_vehicleType == VehicleInfo.VehicleType.Bicycle)
     {
         return otherData.m_nextGridVehicle;
     }
     if ((otherData.m_flags & Vehicle.Flags.Transition) == Vehicle.Flags.None && (citizenData.m_flags & CitizenInstance.Flags.Transition) == CitizenInstance.Flags.None && (otherData.m_flags & Vehicle.Flags.Underground) != Vehicle.Flags.None != ((citizenData.m_flags & CitizenInstance.Flags.Underground) != CitizenInstance.Flags.None))
     {
         return otherData.m_nextGridVehicle;
     }
     Segment3 segment2 = otherData.m_segment;
     Vector3 vector = Vector3.Min (segment2.Min (), otherData.m_targetPos1);
     vector.x -= 1f;
     vector.z -= 1f;
     Vector3 vector2 = Vector3.Max (segment2.Max (), otherData.m_targetPos1);
     vector2.x += 1f;
     vector2.y += 1f;
     vector2.z += 1f;
     if (min.x < vector2.x && max.x > vector.x && min.z < vector2.z && max.z > vector.z && min.y < vector2.y && max.y > vector.y)
     {
         float num = this.m_info.m_radius + 1f;
         float num3;
         float t;
         float num2 = segment.DistanceSqr (segment2, out num3, out t);
         if (num2 < num * num)
         {
             float num4 = num - Mathf.Sqrt (num2);
             float num5 = 1f - num2 / (num * num);
             Vector3 a = segment.Position (num3 * 0.9f);
             Vector3 b = segment2.Position (t);
             a.y = 0f;
             b.y = 0f;
             Vector3 vector3 = Vector3.Normalize (a - b);
             Vector3 rhs = Vector3.Normalize (new Vector3 (segment.b.x - segment.a.x, 0f, segment.b.z - segment.a.z));
             Vector3 vector4 = new Vector3 (rhs.z, 0f, -rhs.x) * Mathf.Abs (Vector3.Dot (vector3, rhs) * 0.5f);
             if (Vector3.Dot (vector3, vector4) >= 0f)
             {
                 vector3 += vector4;
             }
             else
             {
                 vector3 -= vector4;
             }
             pushAmount += vector3 * (num4 * num5);
             pushDivider += num5;
         }
         float magnitude = otherData.GetLastFrameVelocity ().magnitude;
         if (magnitude > 0.1f)
         {
             float num6 = this.m_info.m_radius + 3f;
             segment2.a = segment2.b;
             segment2.b += Vector3.ClampMagnitude (((Vector3)otherData.m_targetPos1) - segment2.b, magnitude * 4f);
             num2 = segment.DistanceSqr (segment2, out num3, out t);
             if (num2 > num * num && num2 < num6 * num6)
             {
                 float num7 = num6 - Mathf.Sqrt (num2);
                 float num8 = 1f - num2 / (num6 * num6);
                 Vector3 a2 = segment.Position (num3 * 0.9f);
                 Vector3 b2 = segment2.Position (t);
                 a2.y = 0f;
                 b2.y = 0f;
                 Vector3 vector5 = a2 - b2;
                 pushAmount += vector5.normalized * (num7 * num8);
                 pushDivider += num8;
             }
         }
     }
     return otherData.m_nextGridVehicle;
 }
开发者ID:klyte45,项目名称:CS-VehicleLimitExpander,代码行数:70,代码来源:FakeCitizenAI.cs


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