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


C# Vehicle.SetFrameData方法代码示例

本文整理汇总了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);
			}
		}
开发者ID:bagukiri,项目名称:csl-traffic,代码行数:54,代码来源:CustomCargoTruckAI.cs


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