Megacity demo game for UOS
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

33 行
1.1 KiB

using Unity.Burst;
using Unity.Entities;
using Unity.Transforms;
namespace Unity.MegaCity.Gameplay
{
/// <summary>
/// System to handle the player vehicle cosmetic physics.
/// </summary>
[BurstCompile]
[UpdateBefore(typeof(TransformSystemGroup))]
[WorldSystemFilter(WorldSystemFilterFlags.LocalSimulation | WorldSystemFilterFlags.ClientSimulation)]
public partial struct PlayerVehicleCosmeticPhysicsSystem : ISystem
{
public void OnCreate(ref SystemState state)
{
state.RequireForUpdate<PlayerVehicleCosmeticPhysics>();
}
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
var vehicleBraking = SystemAPI.GetComponentLookup<VehicleBraking>(true);
var vehicleRoll = SystemAPI.GetComponentLookup<VehicleRoll>(true);
var rollJob = new VehicleRollJob
{
VehicleBrakingLookup = vehicleBraking,
VehicleRollLookup = vehicleRoll
};
state.Dependency = rollJob.ScheduleParallel(state.Dependency);
}
}
}