本文整理汇总了C#中Vehicle.SetFrameData方法的典型用法代码示例。如果您正苦于以下问题:C# Vehicle.SetFrameData方法的具体用法?C# Vehicle.SetFrameData怎么用?C# Vehicle.SetFrameData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle.SetFrameData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SimulationStep
public override void SimulationStep(ushort vehicleID, ref Vehicle vehicleData, ushort leaderID, ref Vehicle leaderData, int lodPhysics)
{
if ((CSLTraffic.Options & OptionsManager.ModOptions.UseRealisticSpeeds) == OptionsManager.ModOptions.UseRealisticSpeeds)
{
if (CustomCarAI.sm_speedData[vehicleID].speedMultiplier == 0 || CustomCarAI.sm_speedData[vehicleID].currentPath != vehicleData.m_path)
{
CustomCarAI.sm_speedData[vehicleID].currentPath = vehicleData.m_path;
CustomCarAI.sm_speedData[vehicleID].SetRandomSpeedMultiplier(0.7f, 1.1f);
}
CustomCarAI.sm_speedData[vehicleID].ApplySpeedMultiplier(this.m_info);
}
if ((vehicleData.m_flags & Vehicle.Flags.Spawned) != Vehicle.Flags.None)
{
Vehicle.Frame lastFrameData = vehicleData.GetLastFrameData();
if (this.m_info.m_isLargeVehicle)
{
int num = Mathf.Clamp((int)(lastFrameData.m_position.x / 320f + 27f), 0, 53);
int num2 = Mathf.Clamp((int)(lastFrameData.m_position.z / 320f + 27f), 0, 53);
CustomCarAI.SimulationStep(this, vehicleID, ref vehicleData, ref lastFrameData, leaderID, ref leaderData, lodPhysics);
int num3 = Mathf.Clamp((int)(lastFrameData.m_position.x / 320f + 27f), 0, 53);
int num4 = Mathf.Clamp((int)(lastFrameData.m_position.z / 320f + 27f), 0, 53);
if ((num3 != num || num4 != num2) && (vehicleData.m_flags & Vehicle.Flags.Spawned) != Vehicle.Flags.None)
{
Singleton<VehicleManager>.instance.RemoveFromGrid(vehicleID, ref vehicleData, true, num, num2);
Singleton<VehicleManager>.instance.AddToGrid(vehicleID, ref vehicleData, true, num3, num4);
}
}
else
{
int num5 = Mathf.Clamp((int)(lastFrameData.m_position.x / 32f + 270f), 0, 539);
int num6 = Mathf.Clamp((int)(lastFrameData.m_position.z / 32f + 270f), 0, 539);
CustomCarAI.SimulationStep(this, vehicleID, ref vehicleData, ref lastFrameData, leaderID, ref leaderData, lodPhysics);
int num7 = Mathf.Clamp((int)(lastFrameData.m_position.x / 32f + 270f), 0, 539);
int num8 = Mathf.Clamp((int)(lastFrameData.m_position.z / 32f + 270f), 0, 539);
if ((num7 != num5 || num8 != num6) && (vehicleData.m_flags & Vehicle.Flags.Spawned) != Vehicle.Flags.None)
{
Singleton<VehicleManager>.instance.RemoveFromGrid(vehicleID, ref vehicleData, false, num5, num6);
Singleton<VehicleManager>.instance.AddToGrid(vehicleID, ref vehicleData, false, num7, num8);
}
}
if ((vehicleData.m_flags & (Vehicle.Flags.Created | Vehicle.Flags.Deleted)) == Vehicle.Flags.Created)
{
this.FrameDataUpdated(vehicleID, ref vehicleData, ref lastFrameData);
vehicleData.SetFrameData(Singleton<SimulationManager>.instance.m_currentFrameIndex, lastFrameData);
}
}
if ((CSLTraffic.Options & OptionsManager.ModOptions.UseRealisticSpeeds) == OptionsManager.ModOptions.UseRealisticSpeeds)
{
CustomCarAI.sm_speedData[vehicleID].RestoreVehicleSpeed(this.m_info);
}
}