public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var deserializerState = new GhostDeserializerState { GhostMap = GhostMap }; var ghostEntityArray = chunk.GetNativeArray(ghostEntityType); var ghostSnapshotDataArray = chunk.GetBufferAccessor(ghostSnapshotDataType); var predictedGhostComponentArray = chunk.GetNativeArray(predictedGhostComponentType); #if UNITY_EDITOR || DEVELOPMENT_BUILD var minMaxOffset = ThreadIndex * (JobsUtility.CacheLineSize / 4); #endif for (int entityIndex = 0; entityIndex < ghostEntityArray.Length; ++entityIndex) { var snapshot = ghostSnapshotDataArray[entityIndex]; #if UNITY_EDITOR || DEVELOPMENT_BUILD var latestTick = snapshot.GetLatestTick(); if (latestTick != 0) { if (minMaxSnapshotTick[minMaxOffset] == 0 || SequenceHelpers.IsNewer(minMaxSnapshotTick[minMaxOffset], latestTick)) { minMaxSnapshotTick[minMaxOffset] = latestTick; } if (minMaxSnapshotTick[minMaxOffset + 1] == 0 || SequenceHelpers.IsNewer(latestTick, minMaxSnapshotTick[minMaxOffset + 1])) { minMaxSnapshotTick[minMaxOffset + 1] = latestTick; } } #endif SpawnerSnapshotData snapshotData; snapshot.GetDataAtTick(targetTick, out snapshotData); var predictedData = predictedGhostComponentArray[entityIndex]; var lastPredictedTickInst = lastPredictedTick; if (lastPredictedTickInst == 0 || predictedData.AppliedTick != snapshotData.Tick) { lastPredictedTickInst = snapshotData.Tick; } else if (!SequenceHelpers.IsNewer(lastPredictedTickInst, snapshotData.Tick)) { lastPredictedTickInst = snapshotData.Tick; } if (minPredictedTick[ThreadIndex] == 0 || SequenceHelpers.IsNewer(minPredictedTick[ThreadIndex], lastPredictedTickInst)) { minPredictedTick[ThreadIndex] = lastPredictedTickInst; } predictedGhostComponentArray[entityIndex] = new PredictedGhostComponent { AppliedTick = snapshotData.Tick, PredictionStartTick = lastPredictedTickInst }; if (lastPredictedTickInst != snapshotData.Tick) { continue; } } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var deserializerState = new GhostDeserializerState { GhostMap = GhostMap }; var ghostEntityArray = chunk.GetNativeArray(ghostEntityType); var ghostSnapshotDataArray = chunk.GetBufferAccessor(ghostSnapshotDataType); var predictedGhostComponentArray = chunk.GetNativeArray(predictedGhostComponentType); var ghostCharacterPredictedDataArray = chunk.GetNativeArray(ghostCharacterPredictedDataType); var ghostCharacterReplicatedDataArray = chunk.GetNativeArray(ghostCharacterReplicatedDataType); var ghostCharacterControllerGroundSupportDataArray = chunk.GetNativeArray(ghostCharacterControllerGroundSupportDataType); var ghostCharacterControllerMoveResultArray = chunk.GetNativeArray(ghostCharacterControllerMoveResultType); var ghostCharacterControllerVelocityArray = chunk.GetNativeArray(ghostCharacterControllerVelocityType); var ghostHealthStateDataArray = chunk.GetNativeArray(ghostHealthStateDataType); var ghostInventoryStateArray = chunk.GetNativeArray(ghostInventoryStateType); var ghostPlayerOwnerPlayerIdArray = chunk.GetNativeArray(ghostPlayerOwnerPlayerIdType); var ghostPlayerControlledStateArray = chunk.GetNativeArray(ghostPlayerControlledStateType); var ghostLinkedEntityGroupArray = chunk.GetBufferAccessor(ghostLinkedEntityGroupType); #if UNITY_EDITOR || DEVELOPMENT_BUILD var minMaxOffset = ThreadIndex * (JobsUtility.CacheLineSize / 4); #endif for (int entityIndex = 0; entityIndex < ghostEntityArray.Length; ++entityIndex) { var snapshot = ghostSnapshotDataArray[entityIndex]; #if UNITY_EDITOR || DEVELOPMENT_BUILD var latestTick = snapshot.GetLatestTick(); if (latestTick != 0) { if (minMaxSnapshotTick[minMaxOffset] == 0 || SequenceHelpers.IsNewer(minMaxSnapshotTick[minMaxOffset], latestTick)) { minMaxSnapshotTick[minMaxOffset] = latestTick; } if (minMaxSnapshotTick[minMaxOffset + 1] == 0 || SequenceHelpers.IsNewer(latestTick, minMaxSnapshotTick[minMaxOffset + 1])) { minMaxSnapshotTick[minMaxOffset + 1] = latestTick; } } #endif Char_TerraformerSnapshotData snapshotData; snapshot.GetDataAtTick(targetTick, out snapshotData); var predictedData = predictedGhostComponentArray[entityIndex]; var lastPredictedTickInst = lastPredictedTick; if (lastPredictedTickInst == 0 || predictedData.AppliedTick != snapshotData.Tick) { lastPredictedTickInst = snapshotData.Tick; } else if (!SequenceHelpers.IsNewer(lastPredictedTickInst, snapshotData.Tick)) { lastPredictedTickInst = snapshotData.Tick; } if (minPredictedTick[ThreadIndex] == 0 || SequenceHelpers.IsNewer(minPredictedTick[ThreadIndex], lastPredictedTickInst)) { minPredictedTick[ThreadIndex] = lastPredictedTickInst; } predictedGhostComponentArray[entityIndex] = new PredictedGhostComponent { AppliedTick = snapshotData.Tick, PredictionStartTick = lastPredictedTickInst }; if (lastPredictedTickInst != snapshotData.Tick) { continue; } var ghostCharacterPredictedData = ghostCharacterPredictedDataArray[entityIndex]; var ghostCharacterReplicatedData = ghostCharacterReplicatedDataArray[entityIndex]; var ghostCharacterControllerGroundSupportData = ghostCharacterControllerGroundSupportDataArray[entityIndex]; var ghostCharacterControllerMoveResult = ghostCharacterControllerMoveResultArray[entityIndex]; var ghostCharacterControllerVelocity = ghostCharacterControllerVelocityArray[entityIndex]; var ghostHealthStateData = ghostHealthStateDataArray[entityIndex]; var ghostInventoryState = ghostInventoryStateArray[entityIndex]; var ghostPlayerOwnerPlayerId = ghostPlayerOwnerPlayerIdArray[entityIndex]; var ghostPlayerControlledState = ghostPlayerControlledStateArray[entityIndex]; var ghostChild0AbilityAbilityControl = ghostAbilityAbilityControlFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value]; var ghostChild0AbilityMovementInterpolatedState = ghostAbilityMovementInterpolatedStateFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value]; var ghostChild0AbilityMovementPredictedState = ghostAbilityMovementPredictedStateFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value]; var ghostChild1AbilityAbilityControl = ghostAbilityAbilityControlFromEntity[ghostLinkedEntityGroupArray[entityIndex][2].Value]; var ghostChild1AbilitySprintPredictedState = ghostAbilitySprintPredictedStateFromEntity[ghostLinkedEntityGroupArray[entityIndex][2].Value]; var ghostChild2AbilityAbilityControl = ghostAbilityAbilityControlFromEntity[ghostLinkedEntityGroupArray[entityIndex][3].Value]; var ghostChild3AbilityAbilityControl = ghostAbilityAbilityControlFromEntity[ghostLinkedEntityGroupArray[entityIndex][4].Value]; ghostCharacterPredictedData.tick = snapshotData.GetCharacterPredictedDatatick(deserializerState); ghostCharacterPredictedData.position = snapshotData.GetCharacterPredictedDataposition(deserializerState); ghostCharacterPredictedData.velocity = snapshotData.GetCharacterPredictedDatavelocity(deserializerState); ghostCharacterPredictedData.sprinting = snapshotData.GetCharacterPredictedDatasprinting(deserializerState); ghostCharacterPredictedData.cameraProfile = snapshotData.GetCharacterPredictedDatacameraProfile(deserializerState); ghostCharacterPredictedData.damageTick = snapshotData.GetCharacterPredictedDatadamageTick(deserializerState); ghostCharacterPredictedData.damageDirection = snapshotData.GetCharacterPredictedDatadamageDirection(deserializerState); ghostCharacterReplicatedData.heroTypeIndex = snapshotData.GetCharacterReplicatedDataheroTypeIndex(deserializerState); ghostCharacterControllerGroundSupportData.SurfaceNormal = snapshotData.GetCharacterControllerGroundSupportDataSurfaceNormal(deserializerState); ghostCharacterControllerGroundSupportData.SurfaceVelocity = snapshotData.GetCharacterControllerGroundSupportDataSurfaceVelocity(deserializerState); ghostCharacterControllerGroundSupportData.SupportedState = snapshotData.GetCharacterControllerGroundSupportDataSupportedState(deserializerState); ghostCharacterControllerMoveResult.MoveResult = snapshotData.GetCharacterControllerMoveResultMoveResult(deserializerState); ghostCharacterControllerVelocity.Velocity = snapshotData.GetCharacterControllerVelocityVelocity(deserializerState); ghostHealthStateData.health = snapshotData.GetHealthStateDatahealth(deserializerState); ghostInventoryState.activeSlot = snapshotData.GetInventoryStateactiveSlot(deserializerState); ghostPlayerOwnerPlayerId.Value = snapshotData.GetPlayerOwnerPlayerIdValue(deserializerState); ghostPlayerControlledState.resetCommandTick = snapshotData.GetPlayerControlledStateresetCommandTick(deserializerState); ghostPlayerControlledState.resetCommandLookYaw = snapshotData.GetPlayerControlledStateresetCommandLookYaw(deserializerState); ghostPlayerControlledState.resetCommandLookPitch = snapshotData.GetPlayerControlledStateresetCommandLookPitch(deserializerState); ghostChild0AbilityAbilityControl.behaviorState = snapshotData.GetChild0AbilityAbilityControlbehaviorState(deserializerState); ghostChild0AbilityAbilityControl.requestDeactivate = snapshotData.GetChild0AbilityAbilityControlrequestDeactivate(deserializerState); ghostChild0AbilityMovementInterpolatedState.charLocoState = snapshotData.GetChild0AbilityMovementInterpolatedStatecharLocoState(deserializerState); ghostChild0AbilityMovementInterpolatedState.charLocoTick = snapshotData.GetChild0AbilityMovementInterpolatedStatecharLocoTick(deserializerState); ghostChild0AbilityMovementInterpolatedState.crouching = snapshotData.GetChild0AbilityMovementInterpolatedStatecrouching(deserializerState); ghostChild0AbilityMovementPredictedState.locoState = snapshotData.GetChild0AbilityMovementPredictedStatelocoState(deserializerState); ghostChild0AbilityMovementPredictedState.locoStartTick = snapshotData.GetChild0AbilityMovementPredictedStatelocoStartTick(deserializerState); ghostChild0AbilityMovementPredictedState.jumpCount = snapshotData.GetChild0AbilityMovementPredictedStatejumpCount(deserializerState); ghostChild0AbilityMovementPredictedState.crouching = snapshotData.GetChild0AbilityMovementPredictedStatecrouching(deserializerState); ghostChild1AbilityAbilityControl.behaviorState = snapshotData.GetChild1AbilityAbilityControlbehaviorState(deserializerState); ghostChild1AbilityAbilityControl.requestDeactivate = snapshotData.GetChild1AbilityAbilityControlrequestDeactivate(deserializerState); ghostChild1AbilitySprintPredictedState.active = snapshotData.GetChild1AbilitySprintPredictedStateactive(deserializerState); ghostChild1AbilitySprintPredictedState.terminating = snapshotData.GetChild1AbilitySprintPredictedStateterminating(deserializerState); ghostChild1AbilitySprintPredictedState.terminateStartTick = snapshotData.GetChild1AbilitySprintPredictedStateterminateStartTick(deserializerState); ghostChild2AbilityAbilityControl.behaviorState = snapshotData.GetChild2AbilityAbilityControlbehaviorState(deserializerState); ghostChild2AbilityAbilityControl.requestDeactivate = snapshotData.GetChild2AbilityAbilityControlrequestDeactivate(deserializerState); ghostChild3AbilityAbilityControl.behaviorState = snapshotData.GetChild3AbilityAbilityControlbehaviorState(deserializerState); ghostChild3AbilityAbilityControl.requestDeactivate = snapshotData.GetChild3AbilityAbilityControlrequestDeactivate(deserializerState); ghostAbilityAbilityControlFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value] = ghostChild0AbilityAbilityControl; ghostAbilityMovementInterpolatedStateFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value] = ghostChild0AbilityMovementInterpolatedState; ghostAbilityMovementPredictedStateFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value] = ghostChild0AbilityMovementPredictedState; ghostAbilityAbilityControlFromEntity[ghostLinkedEntityGroupArray[entityIndex][2].Value] = ghostChild1AbilityAbilityControl; ghostAbilitySprintPredictedStateFromEntity[ghostLinkedEntityGroupArray[entityIndex][2].Value] = ghostChild1AbilitySprintPredictedState; ghostAbilityAbilityControlFromEntity[ghostLinkedEntityGroupArray[entityIndex][3].Value] = ghostChild2AbilityAbilityControl; ghostAbilityAbilityControlFromEntity[ghostLinkedEntityGroupArray[entityIndex][4].Value] = ghostChild3AbilityAbilityControl; ghostCharacterPredictedDataArray[entityIndex] = ghostCharacterPredictedData; ghostCharacterReplicatedDataArray[entityIndex] = ghostCharacterReplicatedData; ghostCharacterControllerGroundSupportDataArray[entityIndex] = ghostCharacterControllerGroundSupportData; ghostCharacterControllerMoveResultArray[entityIndex] = ghostCharacterControllerMoveResult; ghostCharacterControllerVelocityArray[entityIndex] = ghostCharacterControllerVelocity; ghostHealthStateDataArray[entityIndex] = ghostHealthStateData; ghostInventoryStateArray[entityIndex] = ghostInventoryState; ghostPlayerOwnerPlayerIdArray[entityIndex] = ghostPlayerOwnerPlayerId; ghostPlayerControlledStateArray[entityIndex] = ghostPlayerControlledState; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { GhostDeserializerState deserializerState = new GhostDeserializerState { GhostMap = GhostMap }; NativeArray <Entity> ghostEntityArray = chunk.GetNativeArray(ghostEntityType); BufferAccessor <NetCodePlayModeTestGhostObjectSnapshotData> ghostSnapshotDataArray = chunk.GetBufferAccessor(ghostSnapshotDataType); NativeArray <PredictedGhostComponent> predictedGhostComponentArray = chunk.GetNativeArray(predictedGhostComponentType); NativeArray <Rotation> ghostRotationArray = chunk.GetNativeArray(ghostRotationType); NativeArray <Translation> ghostTranslationArray = chunk.GetNativeArray(ghostTranslationType); #if UNITY_EDITOR || DEVELOPMENT_BUILD int minMaxOffset = ThreadIndex * (JobsUtility.CacheLineSize / 4); #endif for (int entityIndex = 0; entityIndex < ghostEntityArray.Length; ++entityIndex) { DynamicBuffer <NetCodePlayModeTestGhostObjectSnapshotData> snapshot = ghostSnapshotDataArray[entityIndex]; #if UNITY_EDITOR || DEVELOPMENT_BUILD uint latestTick = snapshot.GetLatestTick(); if (latestTick != 0) { if (minMaxSnapshotTick[minMaxOffset] == 0 || SequenceHelpers.IsNewer(minMaxSnapshotTick[minMaxOffset], latestTick)) { minMaxSnapshotTick[minMaxOffset] = latestTick; } if (minMaxSnapshotTick[minMaxOffset + 1] == 0 || SequenceHelpers.IsNewer(latestTick, minMaxSnapshotTick[minMaxOffset + 1])) { minMaxSnapshotTick[minMaxOffset + 1] = latestTick; } } #endif NetCodePlayModeTestGhostObjectSnapshotData snapshotData; snapshot.GetDataAtTick(targetTick, out snapshotData); PredictedGhostComponent predictedData = predictedGhostComponentArray[entityIndex]; uint lastPredictedTickInst = lastPredictedTick; if (lastPredictedTickInst == 0 || predictedData.AppliedTick != snapshotData.Tick) { lastPredictedTickInst = snapshotData.Tick; } else if (!SequenceHelpers.IsNewer(lastPredictedTickInst, snapshotData.Tick)) { lastPredictedTickInst = snapshotData.Tick; } if (minPredictedTick[ThreadIndex] == 0 || SequenceHelpers.IsNewer(minPredictedTick[ThreadIndex], lastPredictedTickInst)) { minPredictedTick[ThreadIndex] = lastPredictedTickInst; } predictedGhostComponentArray[entityIndex] = new PredictedGhostComponent { AppliedTick = snapshotData.Tick, PredictionStartTick = lastPredictedTickInst }; if (lastPredictedTickInst != snapshotData.Tick) { continue; } Rotation ghostRotation = ghostRotationArray[entityIndex]; Translation ghostTranslation = ghostTranslationArray[entityIndex]; ghostRotation.Value = snapshotData.GetRotationValue(deserializerState); ghostTranslation.Value = snapshotData.GetTranslationValue(deserializerState); ghostRotationArray[entityIndex] = ghostRotation; ghostTranslationArray[entityIndex] = ghostTranslation; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var deserializerState = new GhostDeserializerState { GhostMap = GhostMap }; var ghostEntityArray = chunk.GetNativeArray(ghostEntityType); var ghostSnapshotDataArray = chunk.GetBufferAccessor(ghostSnapshotDataType); var predictedGhostComponentArray = chunk.GetNativeArray(predictedGhostComponentType); #region __GHOST_PREDICTED_COMPONENT_ARRAY__ var ghost__GHOST_COMPONENT_TYPE_NAME__Array = chunk.GetNativeArray(ghost__GHOST_COMPONENT_TYPE_NAME__Type); #endregion #region __GHOST_PREDICTED_BUFFER_ARRAY__ var ghost__GHOST_COMPONENT_TYPE_NAME__Array = chunk.GetBufferAccessor(ghost__GHOST_COMPONENT_TYPE_NAME__Type); #endregion #if UNITY_EDITOR || DEVELOPMENT_BUILD var minMaxOffset = ThreadIndex * (JobsUtility.CacheLineSize / 4); #endif for (int entityIndex = 0; entityIndex < ghostEntityArray.Length; ++entityIndex) { var snapshot = ghostSnapshotDataArray[entityIndex]; #if UNITY_EDITOR || DEVELOPMENT_BUILD var latestTick = snapshot.GetLatestTick(); if (latestTick != 0) { if (minMaxSnapshotTick[minMaxOffset] == 0 || SequenceHelpers.IsNewer(minMaxSnapshotTick[minMaxOffset], latestTick)) { minMaxSnapshotTick[minMaxOffset] = latestTick; } if (minMaxSnapshotTick[minMaxOffset + 1] == 0 || SequenceHelpers.IsNewer(latestTick, minMaxSnapshotTick[minMaxOffset + 1])) { minMaxSnapshotTick[minMaxOffset + 1] = latestTick; } } #endif __GHOST_NAME__SnapshotData snapshotData; snapshot.GetDataAtTick(targetTick, out snapshotData); var predictedData = predictedGhostComponentArray[entityIndex]; var lastPredictedTickInst = lastPredictedTick; if (lastPredictedTickInst == 0 || predictedData.AppliedTick != snapshotData.Tick) { lastPredictedTickInst = snapshotData.Tick; } else if (!SequenceHelpers.IsNewer(lastPredictedTickInst, snapshotData.Tick)) { lastPredictedTickInst = snapshotData.Tick; } if (minPredictedTick[ThreadIndex] == 0 || SequenceHelpers.IsNewer(minPredictedTick[ThreadIndex], lastPredictedTickInst)) { minPredictedTick[ThreadIndex] = lastPredictedTickInst; } predictedGhostComponentArray[entityIndex] = new PredictedGhostComponent { AppliedTick = snapshotData.Tick, PredictionStartTick = lastPredictedTickInst }; if (lastPredictedTickInst != snapshotData.Tick) { continue; } #region __GHOST_PREDICTED_BEGIN_ASSIGN__ var ghost__GHOST_COMPONENT_TYPE_NAME__ = ghost__GHOST_COMPONENT_TYPE_NAME__Array[entityIndex]; #endregion #region __GHOST_PREDICTED_BEGIN_ASSIGN_CHILD__ var ghost__GHOST_COMPONENT_TYPE_NAME__ = ghost__GHOST_COMPONENT_FROM_ENTITY_NAME__FromEntity[ghostLinkedEntityGroupArray[entityIndex][__GHOST_ENTITY_INDEX__].Value]; #endregion #region __GHOST_PREDICTED_ASSIGN__ ghost__GHOST_COMPONENT_TYPE_NAME__.__GHOST_FIELD_NAME__ = snapshotData.Get__GHOST_COMPONENT_TYPE_NAME____GHOST_FIELD_NAME__(deserializerState); #endregion #region __GHOST_PREDICTED_END_ASSIGN_CHILD__ ghost__GHOST_COMPONENT_FROM_ENTITY_NAME__FromEntity[ghostLinkedEntityGroupArray[entityIndex][__GHOST_ENTITY_INDEX__].Value] = ghost__GHOST_COMPONENT_TYPE_NAME__; #endregion #region __GHOST_PREDICTED_END_ASSIGN__ ghost__GHOST_COMPONENT_TYPE_NAME__Array[entityIndex] = ghost__GHOST_COMPONENT_TYPE_NAME__; #endregion } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var deserializerState = new GhostDeserializerState { GhostMap = GhostMap }; var ghostEntityArray = chunk.GetNativeArray(ghostEntityType); var ghostSnapshotDataArray = chunk.GetBufferAccessor(ghostSnapshotDataType); var predictedGhostComponentArray = chunk.GetNativeArray(predictedGhostComponentType); var ghostPlayerDataArray = chunk.GetNativeArray(ghostPlayerDataType); var ghostRotationArray = chunk.GetNativeArray(ghostRotationType); var ghostTranslationArray = chunk.GetNativeArray(ghostTranslationType); #if UNITY_EDITOR || DEVELOPMENT_BUILD var minMaxOffset = ThreadIndex * (JobsUtility.CacheLineSize / 4); #endif for (int entityIndex = 0; entityIndex < ghostEntityArray.Length; ++entityIndex) { var snapshot = ghostSnapshotDataArray[entityIndex]; #if UNITY_EDITOR || DEVELOPMENT_BUILD var latestTick = snapshot.GetLatestTick(); if (latestTick != 0) { if (minMaxSnapshotTick[minMaxOffset] == 0 || SequenceHelpers.IsNewer(minMaxSnapshotTick[minMaxOffset], latestTick)) { minMaxSnapshotTick[minMaxOffset] = latestTick; } if (minMaxSnapshotTick[minMaxOffset + 1] == 0 || SequenceHelpers.IsNewer(latestTick, minMaxSnapshotTick[minMaxOffset + 1])) { minMaxSnapshotTick[minMaxOffset + 1] = latestTick; } } #endif SphereSnapshotData snapshotData; snapshot.GetDataAtTick(targetTick, out snapshotData); var predictedData = predictedGhostComponentArray[entityIndex]; var lastPredictedTickInst = lastPredictedTick; if (lastPredictedTickInst == 0 || predictedData.AppliedTick != snapshotData.Tick) { lastPredictedTickInst = snapshotData.Tick; } else if (!SequenceHelpers.IsNewer(lastPredictedTickInst, snapshotData.Tick)) { lastPredictedTickInst = snapshotData.Tick; } if (minPredictedTick[ThreadIndex] == 0 || SequenceHelpers.IsNewer(minPredictedTick[ThreadIndex], lastPredictedTickInst)) { minPredictedTick[ThreadIndex] = lastPredictedTickInst; } predictedGhostComponentArray[entityIndex] = new PredictedGhostComponent { AppliedTick = snapshotData.Tick, PredictionStartTick = lastPredictedTickInst }; if (lastPredictedTickInst != snapshotData.Tick) { continue; } var ghostPlayerData = ghostPlayerDataArray[entityIndex]; var ghostRotation = ghostRotationArray[entityIndex]; var ghostTranslation = ghostTranslationArray[entityIndex]; ghostPlayerData.playerId = snapshotData.GetPlayerDataplayerId(deserializerState); ghostPlayerData.maxHealth = snapshotData.GetPlayerDatamaxHealth(deserializerState); ghostPlayerData.currentHealth = snapshotData.GetPlayerDatacurrentHealth(deserializerState); ghostPlayerData.death = snapshotData.GetPlayerDatadeath(deserializerState); ghostPlayerData.auto = snapshotData.GetPlayerDataauto(deserializerState); ghostPlayerData.autoSpawn = snapshotData.GetPlayerDataautoSpawn(deserializerState); ghostPlayerData.dest = snapshotData.GetPlayerDatadest(deserializerState); ghostPlayerData.dest2 = snapshotData.GetPlayerDatadest2(deserializerState); ghostPlayerData.killedBy = snapshotData.GetPlayerDatakilledBy(deserializerState); ghostPlayerData.killedByID = snapshotData.GetPlayerDatakilledByID(deserializerState); ghostRotation.Value = snapshotData.GetRotationValue(deserializerState); ghostTranslation.Value = snapshotData.GetTranslationValue(deserializerState); ghostPlayerDataArray[entityIndex] = ghostPlayerData; ghostRotationArray[entityIndex] = ghostRotation; ghostTranslationArray[entityIndex] = ghostTranslation; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var deserializerState = new GhostDeserializerState { GhostMap = GhostMap }; var ghostEntityArray = chunk.GetNativeArray(ghostEntityType); var ghostSnapshotDataArray = chunk.GetBufferAccessor(ghostSnapshotDataType); var predictedGhostComponentArray = chunk.GetNativeArray(predictedGhostComponentType); var ghostHealthArray = chunk.GetNativeArray(ghostHealthType); var ghostPlayerUnitArray = chunk.GetNativeArray(ghostPlayerUnitType); var ghostUnitSelectionStateArray = chunk.GetNativeArray(ghostUnitSelectionStateType); var ghostLinkedEntityGroupArray = chunk.GetBufferAccessor(ghostLinkedEntityGroupType); #if UNITY_EDITOR || DEVELOPMENT_BUILD var minMaxOffset = ThreadIndex * (JobsUtility.CacheLineSize / 4); #endif for (int entityIndex = 0; entityIndex < ghostEntityArray.Length; ++entityIndex) { var snapshot = ghostSnapshotDataArray[entityIndex]; #if UNITY_EDITOR || DEVELOPMENT_BUILD var latestTick = snapshot.GetLatestTick(); if (latestTick != 0) { if (minMaxSnapshotTick[minMaxOffset] == 0 || SequenceHelpers.IsNewer(minMaxSnapshotTick[minMaxOffset], latestTick)) { minMaxSnapshotTick[minMaxOffset] = latestTick; } if (minMaxSnapshotTick[minMaxOffset + 1] == 0 || SequenceHelpers.IsNewer(latestTick, minMaxSnapshotTick[minMaxOffset + 1])) { minMaxSnapshotTick[minMaxOffset + 1] = latestTick; } } #endif BArcherSnapshotData snapshotData; snapshot.GetDataAtTick(targetTick, out snapshotData); var predictedData = predictedGhostComponentArray[entityIndex]; var lastPredictedTickInst = lastPredictedTick; if (lastPredictedTickInst == 0 || predictedData.AppliedTick != snapshotData.Tick) { lastPredictedTickInst = snapshotData.Tick; } else if (!SequenceHelpers.IsNewer(lastPredictedTickInst, snapshotData.Tick)) { lastPredictedTickInst = snapshotData.Tick; } if (minPredictedTick[ThreadIndex] == 0 || SequenceHelpers.IsNewer(minPredictedTick[ThreadIndex], lastPredictedTickInst)) { minPredictedTick[ThreadIndex] = lastPredictedTickInst; } predictedGhostComponentArray[entityIndex] = new PredictedGhostComponent { AppliedTick = snapshotData.Tick, PredictionStartTick = lastPredictedTickInst }; if (lastPredictedTickInst != snapshotData.Tick) { continue; } var ghostHealth = ghostHealthArray[entityIndex]; var ghostPlayerUnit = ghostPlayerUnitArray[entityIndex]; var ghostUnitSelectionState = ghostUnitSelectionStateArray[entityIndex]; var ghostRotation = ghostRotationFromEntity[ghostLinkedEntityGroupArray[entityIndex][0].Value]; var ghostTranslation = ghostTranslationFromEntity[ghostLinkedEntityGroupArray[entityIndex][0].Value]; var ghostChild0Rotation = ghostRotationFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value]; var ghostChild0Translation = ghostTranslationFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value]; var ghostChild1Rotation = ghostRotationFromEntity[ghostLinkedEntityGroupArray[entityIndex][2].Value]; var ghostChild1Translation = ghostTranslationFromEntity[ghostLinkedEntityGroupArray[entityIndex][2].Value]; var ghostChild2Rotation = ghostRotationFromEntity[ghostLinkedEntityGroupArray[entityIndex][3].Value]; var ghostChild2Translation = ghostTranslationFromEntity[ghostLinkedEntityGroupArray[entityIndex][3].Value]; var ghostChild3Rotation = ghostRotationFromEntity[ghostLinkedEntityGroupArray[entityIndex][4].Value]; var ghostChild3Translation = ghostTranslationFromEntity[ghostLinkedEntityGroupArray[entityIndex][4].Value]; ghostHealth.Value = snapshotData.GetHealthValue(deserializerState); ghostPlayerUnit.PlayerId = snapshotData.GetPlayerUnitPlayerId(deserializerState); ghostPlayerUnit.UnitId = snapshotData.GetPlayerUnitUnitId(deserializerState); ghostUnitSelectionState.IsSelected = snapshotData.GetUnitSelectionStateIsSelected(deserializerState); ghostRotation.Value = snapshotData.GetRotationValue(deserializerState); ghostTranslation.Value = snapshotData.GetTranslationValue(deserializerState); ghostChild0Rotation.Value = snapshotData.GetChild0RotationValue(deserializerState); ghostChild0Translation.Value = snapshotData.GetChild0TranslationValue(deserializerState); ghostChild1Rotation.Value = snapshotData.GetChild1RotationValue(deserializerState); ghostChild1Translation.Value = snapshotData.GetChild1TranslationValue(deserializerState); ghostChild2Rotation.Value = snapshotData.GetChild2RotationValue(deserializerState); ghostChild2Translation.Value = snapshotData.GetChild2TranslationValue(deserializerState); ghostChild3Rotation.Value = snapshotData.GetChild3RotationValue(deserializerState); ghostChild3Translation.Value = snapshotData.GetChild3TranslationValue(deserializerState); ghostRotationFromEntity[ghostLinkedEntityGroupArray[entityIndex][0].Value] = ghostRotation; ghostTranslationFromEntity[ghostLinkedEntityGroupArray[entityIndex][0].Value] = ghostTranslation; ghostRotationFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value] = ghostChild0Rotation; ghostTranslationFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value] = ghostChild0Translation; ghostRotationFromEntity[ghostLinkedEntityGroupArray[entityIndex][2].Value] = ghostChild1Rotation; ghostTranslationFromEntity[ghostLinkedEntityGroupArray[entityIndex][2].Value] = ghostChild1Translation; ghostRotationFromEntity[ghostLinkedEntityGroupArray[entityIndex][3].Value] = ghostChild2Rotation; ghostTranslationFromEntity[ghostLinkedEntityGroupArray[entityIndex][3].Value] = ghostChild2Translation; ghostRotationFromEntity[ghostLinkedEntityGroupArray[entityIndex][4].Value] = ghostChild3Rotation; ghostTranslationFromEntity[ghostLinkedEntityGroupArray[entityIndex][4].Value] = ghostChild3Translation; ghostHealthArray[entityIndex] = ghostHealth; ghostPlayerUnitArray[entityIndex] = ghostPlayerUnit; ghostUnitSelectionStateArray[entityIndex] = ghostUnitSelectionState; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var deserializerState = new GhostDeserializerState { GhostMap = GhostMap }; var ghostEntityArray = chunk.GetNativeArray(ghostEntityType); var ghostSnapshotDataArray = chunk.GetBufferAccessor(ghostSnapshotDataType); var predictedGhostComponentArray = chunk.GetNativeArray(predictedGhostComponentType); var ghostPlayerStateArray = chunk.GetNativeArray(ghostPlayerStateType); #if UNITY_EDITOR || DEVELOPMENT_BUILD var minMaxOffset = ThreadIndex * (JobsUtility.CacheLineSize / 4); #endif for (int entityIndex = 0; entityIndex < ghostEntityArray.Length; ++entityIndex) { var snapshot = ghostSnapshotDataArray[entityIndex]; #if UNITY_EDITOR || DEVELOPMENT_BUILD var latestTick = snapshot.GetLatestTick(); if (latestTick != 0) { if (minMaxSnapshotTick[minMaxOffset] == 0 || SequenceHelpers.IsNewer(minMaxSnapshotTick[minMaxOffset], latestTick)) { minMaxSnapshotTick[minMaxOffset] = latestTick; } if (minMaxSnapshotTick[minMaxOffset + 1] == 0 || SequenceHelpers.IsNewer(latestTick, minMaxSnapshotTick[minMaxOffset + 1])) { minMaxSnapshotTick[minMaxOffset + 1] = latestTick; } } #endif PlayerStateSnapshotData snapshotData; snapshot.GetDataAtTick(targetTick, out snapshotData); var predictedData = predictedGhostComponentArray[entityIndex]; var lastPredictedTickInst = lastPredictedTick; if (lastPredictedTickInst == 0 || predictedData.AppliedTick != snapshotData.Tick) { lastPredictedTickInst = snapshotData.Tick; } else if (!SequenceHelpers.IsNewer(lastPredictedTickInst, snapshotData.Tick)) { lastPredictedTickInst = snapshotData.Tick; } if (minPredictedTick[ThreadIndex] == 0 || SequenceHelpers.IsNewer(minPredictedTick[ThreadIndex], lastPredictedTickInst)) { minPredictedTick[ThreadIndex] = lastPredictedTickInst; } predictedGhostComponentArray[entityIndex] = new PredictedGhostComponent { AppliedTick = snapshotData.Tick, PredictionStartTick = lastPredictedTickInst }; if (lastPredictedTickInst != snapshotData.Tick) { continue; } var ghostPlayerState = ghostPlayerStateArray[entityIndex]; ghostPlayerState.playerId = snapshotData.GetPlayerStateplayerId(deserializerState); ghostPlayerState.playerName = snapshotData.GetPlayerStateplayerName(deserializerState); ghostPlayerState.teamIndex = snapshotData.GetPlayerStateteamIndex(deserializerState); ghostPlayerState.score = snapshotData.GetPlayerStatescore(deserializerState); ghostPlayerState.gameModeSystemInitialized = snapshotData.GetPlayerStategameModeSystemInitialized(deserializerState); ghostPlayerState.displayCountDown = snapshotData.GetPlayerStatedisplayCountDown(deserializerState); ghostPlayerState.countDown = snapshotData.GetPlayerStatecountDown(deserializerState); ghostPlayerState.displayScoreBoard = snapshotData.GetPlayerStatedisplayScoreBoard(deserializerState); ghostPlayerState.displayGameScore = snapshotData.GetPlayerStatedisplayGameScore(deserializerState); ghostPlayerState.displayGameResult = snapshotData.GetPlayerStatedisplayGameResult(deserializerState); ghostPlayerState.gameResult = snapshotData.GetPlayerStategameResult(deserializerState); ghostPlayerState.displayGoal = snapshotData.GetPlayerStatedisplayGoal(deserializerState); ghostPlayerState.goalPosition = snapshotData.GetPlayerStategoalPosition(deserializerState); ghostPlayerState.goalDefendersColor = snapshotData.GetPlayerStategoalDefendersColor(deserializerState); ghostPlayerState.goalAttackersColor = snapshotData.GetPlayerStategoalAttackersColor(deserializerState); ghostPlayerState.goalAttackers = snapshotData.GetPlayerStategoalAttackers(deserializerState); ghostPlayerState.goalDefenders = snapshotData.GetPlayerStategoalDefenders(deserializerState); ghostPlayerState.goalString = snapshotData.GetPlayerStategoalString(deserializerState); ghostPlayerState.actionString = snapshotData.GetPlayerStateactionString(deserializerState); ghostPlayerState.goalCompletion = snapshotData.GetPlayerStategoalCompletion(deserializerState); ghostPlayerStateArray[entityIndex] = ghostPlayerState; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var deserializerState = new GhostDeserializerState { GhostMap = GhostMap }; var ghostEntityArray = chunk.GetNativeArray(ghostEntityType); var ghostSnapshotDataArray = chunk.GetBufferAccessor(ghostSnapshotDataType); var predictedGhostComponentArray = chunk.GetNativeArray(predictedGhostComponentType); var ghostItemInputStateArray = chunk.GetNativeArray(ghostItemInputStateType); var ghostLinkedEntityGroupArray = chunk.GetBufferAccessor(ghostLinkedEntityGroupType); #if UNITY_EDITOR || DEVELOPMENT_BUILD var minMaxOffset = ThreadIndex * (JobsUtility.CacheLineSize / 4); #endif for (int entityIndex = 0; entityIndex < ghostEntityArray.Length; ++entityIndex) { var snapshot = ghostSnapshotDataArray[entityIndex]; #if UNITY_EDITOR || DEVELOPMENT_BUILD var latestTick = snapshot.GetLatestTick(); if (latestTick != 0) { if (minMaxSnapshotTick[minMaxOffset] == 0 || SequenceHelpers.IsNewer(minMaxSnapshotTick[minMaxOffset], latestTick)) { minMaxSnapshotTick[minMaxOffset] = latestTick; } if (minMaxSnapshotTick[minMaxOffset + 1] == 0 || SequenceHelpers.IsNewer(latestTick, minMaxSnapshotTick[minMaxOffset + 1])) { minMaxSnapshotTick[minMaxOffset + 1] = latestTick; } } #endif Weapon_TerraformerSnapshotData snapshotData; snapshot.GetDataAtTick(targetTick, out snapshotData); var predictedData = predictedGhostComponentArray[entityIndex]; var lastPredictedTickInst = lastPredictedTick; if (lastPredictedTickInst == 0 || predictedData.AppliedTick != snapshotData.Tick) { lastPredictedTickInst = snapshotData.Tick; } else if (!SequenceHelpers.IsNewer(lastPredictedTickInst, snapshotData.Tick)) { lastPredictedTickInst = snapshotData.Tick; } if (minPredictedTick[ThreadIndex] == 0 || SequenceHelpers.IsNewer(minPredictedTick[ThreadIndex], lastPredictedTickInst)) { minPredictedTick[ThreadIndex] = lastPredictedTickInst; } predictedGhostComponentArray[entityIndex] = new PredictedGhostComponent { AppliedTick = snapshotData.Tick, PredictionStartTick = lastPredictedTickInst }; if (lastPredictedTickInst != snapshotData.Tick) { continue; } var ghostItemInputState = ghostItemInputStateArray[entityIndex]; var ghostChild0AbilityAbilityAction = ghostAbilityAbilityActionFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value]; var ghostChild0AbilityAbilityControl = ghostAbilityAbilityControlFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value]; var ghostChild0AbilityAutoRifleInterpolatedState = ghostAbilityAutoRifleInterpolatedStateFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value]; var ghostChild0AbilityAutoRiflePredictedState = ghostAbilityAutoRiflePredictedStateFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value]; ghostItemInputState.owner = snapshotData.GetItemInputStateowner(deserializerState); ghostItemInputState.slot = snapshotData.GetItemInputStateslot(deserializerState); ghostItemInputState.playerId = snapshotData.GetItemInputStateplayerId(deserializerState); ghostChild0AbilityAbilityAction.action = snapshotData.GetChild0AbilityAbilityActionaction(deserializerState); ghostChild0AbilityAbilityAction.actionStartTick = snapshotData.GetChild0AbilityAbilityActionactionStartTick(deserializerState); ghostChild0AbilityAbilityControl.behaviorState = snapshotData.GetChild0AbilityAbilityControlbehaviorState(deserializerState); ghostChild0AbilityAbilityControl.requestDeactivate = snapshotData.GetChild0AbilityAbilityControlrequestDeactivate(deserializerState); ghostChild0AbilityAutoRifleInterpolatedState.fireTick = snapshotData.GetChild0AbilityAutoRifleInterpolatedStatefireTick(deserializerState); ghostChild0AbilityAutoRifleInterpolatedState.fireEndPos = snapshotData.GetChild0AbilityAutoRifleInterpolatedStatefireEndPos(deserializerState); ghostChild0AbilityAutoRifleInterpolatedState.impactType = snapshotData.GetChild0AbilityAutoRifleInterpolatedStateimpactType(deserializerState); ghostChild0AbilityAutoRifleInterpolatedState.impactNormal = snapshotData.GetChild0AbilityAutoRifleInterpolatedStateimpactNormal(deserializerState); ghostChild0AbilityAutoRiflePredictedState.action = snapshotData.GetChild0AbilityAutoRiflePredictedStateaction(deserializerState); ghostChild0AbilityAutoRiflePredictedState.phaseStartTick = snapshotData.GetChild0AbilityAutoRiflePredictedStatephaseStartTick(deserializerState); ghostChild0AbilityAutoRiflePredictedState.ammoInClip = snapshotData.GetChild0AbilityAutoRiflePredictedStateammoInClip(deserializerState); ghostChild0AbilityAutoRiflePredictedState.COF = snapshotData.GetChild0AbilityAutoRiflePredictedStateCOF(deserializerState); ghostAbilityAbilityActionFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value] = ghostChild0AbilityAbilityAction; ghostAbilityAbilityControlFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value] = ghostChild0AbilityAbilityControl; ghostAbilityAutoRifleInterpolatedStateFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value] = ghostChild0AbilityAutoRifleInterpolatedState; ghostAbilityAutoRiflePredictedStateFromEntity[ghostLinkedEntityGroupArray[entityIndex][1].Value] = ghostChild0AbilityAutoRiflePredictedState; ghostItemInputStateArray[entityIndex] = ghostItemInputState; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var deserializerState = new GhostDeserializerState { GhostMap = GhostMap }; var ghostEntityArray = chunk.GetNativeArray(ghostEntityType); var ghostSnapshotDataArray = chunk.GetBufferAccessor(ghostSnapshotDataType); var predictedGhostComponentArray = chunk.GetNativeArray(predictedGhostComponentType); var ghostPilotDataArray = chunk.GetNativeArray(ghostPilotDataType); var ghostPilotMovementSystemDataArray = chunk.GetNativeArray(ghostPilotMovementSystemDataType); var ghostRotationArray = chunk.GetNativeArray(ghostRotationType); var ghostTranslationArray = chunk.GetNativeArray(ghostTranslationType); #if UNITY_EDITOR || DEVELOPMENT_BUILD var minMaxOffset = ThreadIndex * (JobsUtility.CacheLineSize / 4); #endif for (int entityIndex = 0; entityIndex < ghostEntityArray.Length; ++entityIndex) { var snapshot = ghostSnapshotDataArray[entityIndex]; #if UNITY_EDITOR || DEVELOPMENT_BUILD var latestTick = snapshot.GetLatestTick(); if (latestTick != 0) { if (minMaxSnapshotTick[minMaxOffset] == 0 || SequenceHelpers.IsNewer(minMaxSnapshotTick[minMaxOffset], latestTick)) { minMaxSnapshotTick[minMaxOffset] = latestTick; } if (minMaxSnapshotTick[minMaxOffset + 1] == 0 || SequenceHelpers.IsNewer(latestTick, minMaxSnapshotTick[minMaxOffset + 1])) { minMaxSnapshotTick[minMaxOffset + 1] = latestTick; } } #endif PilotSnapshotData snapshotData; snapshot.GetDataAtTick(targetTick, out snapshotData); var predictedData = predictedGhostComponentArray[entityIndex]; var lastPredictedTickInst = lastPredictedTick; if (lastPredictedTickInst == 0 || predictedData.AppliedTick != snapshotData.Tick) { lastPredictedTickInst = snapshotData.Tick; } else if (!SequenceHelpers.IsNewer(lastPredictedTickInst, snapshotData.Tick)) { lastPredictedTickInst = snapshotData.Tick; } if (minPredictedTick[ThreadIndex] == 0 || SequenceHelpers.IsNewer(minPredictedTick[ThreadIndex], lastPredictedTickInst)) { minPredictedTick[ThreadIndex] = lastPredictedTickInst; } predictedGhostComponentArray[entityIndex] = new PredictedGhostComponent { AppliedTick = snapshotData.Tick, PredictionStartTick = lastPredictedTickInst }; if (lastPredictedTickInst != snapshotData.Tick) { continue; } var ghostPilotData = ghostPilotDataArray[entityIndex]; var ghostPilotMovementSystemData = ghostPilotMovementSystemDataArray[entityIndex]; var ghostRotation = ghostRotationArray[entityIndex]; var ghostTranslation = ghostTranslationArray[entityIndex]; ghostPilotData.PlayerId = snapshotData.GetPilotDataPlayerId(deserializerState); ghostPilotMovementSystemData.velocity = snapshotData.GetPilotMovementSystemDatavelocity(deserializerState); ghostPilotMovementSystemData.onGround = snapshotData.GetPilotMovementSystemDataonGround(deserializerState); ghostPilotMovementSystemData.jumpCooldown = snapshotData.GetPilotMovementSystemDatajumpCooldown(deserializerState); ghostPilotMovementSystemData.movementMode = snapshotData.GetPilotMovementSystemDatamovementMode(deserializerState); ghostRotation.Value = snapshotData.GetRotationValue(deserializerState); ghostTranslation.Value = snapshotData.GetTranslationValue(deserializerState); ghostPilotDataArray[entityIndex] = ghostPilotData; ghostPilotMovementSystemDataArray[entityIndex] = ghostPilotMovementSystemData; ghostRotationArray[entityIndex] = ghostRotation; ghostTranslationArray[entityIndex] = ghostTranslation; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var deserializerState = new GhostDeserializerState { GhostMap = GhostMap }; var ghostEntityArray = chunk.GetNativeArray(ghostEntityType); var ghostSnapshotDataArray = chunk.GetBufferAccessor(ghostSnapshotDataType); var predictedGhostComponentArray = chunk.GetNativeArray(predictedGhostComponentType); var ghostHealthComponentArray = chunk.GetNativeArray(ghostHealthComponentType); var ghostProgressionComponentArray = chunk.GetNativeArray(ghostProgressionComponentType); var ghostSynchronizedCarComponentArray = chunk.GetNativeArray(ghostSynchronizedCarComponentType); var ghostRotationArray = chunk.GetNativeArray(ghostRotationType); var ghostTranslationArray = chunk.GetNativeArray(ghostTranslationType); #if UNITY_EDITOR || DEVELOPMENT_BUILD var minMaxOffset = ThreadIndex * (JobsUtility.CacheLineSize / 4); #endif for (int entityIndex = 0; entityIndex < ghostEntityArray.Length; ++entityIndex) { var snapshot = ghostSnapshotDataArray[entityIndex]; #if UNITY_EDITOR || DEVELOPMENT_BUILD var latestTick = snapshot.GetLatestTick(); if (latestTick != 0) { if (minMaxSnapshotTick[minMaxOffset] == 0 || SequenceHelpers.IsNewer(minMaxSnapshotTick[minMaxOffset], latestTick)) { minMaxSnapshotTick[minMaxOffset] = latestTick; } if (minMaxSnapshotTick[minMaxOffset + 1] == 0 || SequenceHelpers.IsNewer(latestTick, minMaxSnapshotTick[minMaxOffset + 1])) { minMaxSnapshotTick[minMaxOffset + 1] = latestTick; } } #endif CarStubSnapshotData snapshotData; snapshot.GetDataAtTick(targetTick, out snapshotData); var predictedData = predictedGhostComponentArray[entityIndex]; var lastPredictedTickInst = lastPredictedTick; if (lastPredictedTickInst == 0 || predictedData.AppliedTick != snapshotData.Tick) { lastPredictedTickInst = snapshotData.Tick; } else if (!SequenceHelpers.IsNewer(lastPredictedTickInst, snapshotData.Tick)) { lastPredictedTickInst = snapshotData.Tick; } if (minPredictedTick[ThreadIndex] == 0 || SequenceHelpers.IsNewer(minPredictedTick[ThreadIndex], lastPredictedTickInst)) { minPredictedTick[ThreadIndex] = lastPredictedTickInst; } predictedGhostComponentArray[entityIndex] = new PredictedGhostComponent { AppliedTick = snapshotData.Tick, PredictionStartTick = lastPredictedTickInst }; if (lastPredictedTickInst != snapshotData.Tick) { continue; } var ghostHealthComponent = ghostHealthComponentArray[entityIndex]; var ghostProgressionComponent = ghostProgressionComponentArray[entityIndex]; var ghostSynchronizedCarComponent = ghostSynchronizedCarComponentArray[entityIndex]; var ghostRotation = ghostRotationArray[entityIndex]; var ghostTranslation = ghostTranslationArray[entityIndex]; ghostHealthComponent.Health = snapshotData.GetHealthComponentHealth(deserializerState); ghostProgressionComponent.CrossedCheckpoints = snapshotData.GetProgressionComponentCrossedCheckpoints(deserializerState); ghostSynchronizedCarComponent.PlayerId = snapshotData.GetSynchronizedCarComponentPlayerId(deserializerState); ghostSynchronizedCarComponent.SteerAngle = snapshotData.GetSynchronizedCarComponentSteerAngle(deserializerState); ghostSynchronizedCarComponent.IsShieldActive = snapshotData.GetSynchronizedCarComponentIsShieldActive(deserializerState); ghostRotation.Value = snapshotData.GetRotationValue(deserializerState); ghostTranslation.Value = snapshotData.GetTranslationValue(deserializerState); ghostHealthComponentArray[entityIndex] = ghostHealthComponent; ghostProgressionComponentArray[entityIndex] = ghostProgressionComponent; ghostSynchronizedCarComponentArray[entityIndex] = ghostSynchronizedCarComponent; ghostRotationArray[entityIndex] = ghostRotation; ghostTranslationArray[entityIndex] = ghostTranslation; } }