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