protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var topGroup = World.GetExistingSystem <ClientSimulationSystemGroup>();

        RenderInterpolationSystem.parameters.startTime      = topGroup.UpdateTime;
        RenderInterpolationSystem.parameters.fixedDeltaTime = topGroup.UpdateDeltaTime;

        var posJob = new UpdatePos();

        posJob.positionType             = GetArchetypeChunkComponentType <Translation>();
        posJob.curPositionType          = GetArchetypeChunkComponentType <CurrentSimulatedPosition>(true);
        posJob.prevPositionType         = GetArchetypeChunkComponentType <PreviousSimulatedPosition>();
        posJob.simStartComponentVersion = simStartComponentVersion;
        posJob.simEndComponentVersion   = simEndComponentVersion;

        var rotJob = new UpdateRot();

        rotJob.rotationType             = GetArchetypeChunkComponentType <Rotation>();
        rotJob.curRotationType          = GetArchetypeChunkComponentType <CurrentSimulatedRotation>(true);
        rotJob.prevRotationType         = GetArchetypeChunkComponentType <PreviousSimulatedRotation>();
        rotJob.simStartComponentVersion = simStartComponentVersion;
        rotJob.simEndComponentVersion   = simEndComponentVersion;

        var handles = new NativeArray <JobHandle>(2, Allocator.Temp);

        handles[0] = posJob.Schedule(positionInterpolationGroup, inputDeps);
        handles[1] = rotJob.Schedule(rotationInterpolationGroup, inputDeps);

        simStartComponentVersion = GlobalSystemVersion;

        return(JobHandle.CombineDependencies(handles));
    }
Example #2
0
 void CmdProvideRotationsToServer(Quaternion playerRot)
 {
     syncPlayerRotation = playerRot;
     foreach (NetworkConnection nc in ((PlanetsNetworkManager)PlanetsNetworkManager.singleton).getUpdateListeners(updateAll)){
         #if UNITY_5_4_OR_NEWER
         TargetUpdateRotation(nc, playerRot);
         #else
         UpdateRot ur = new UpdateRot();
         ur.netId = nIdentity.netId;
         ur.rot = playerRot;
         NetworkServer.SendToClient(nc.connectionId, Msgs.updateRot, ur);
         #endif
     }
 }
Example #3
0
 public void TargetUpdateRot(UpdateRot ur)
 {
     syncPlayerRotation = ur.rot;
 }