Exemplo n.º 1
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var ghostEntityMap = m_GhostUpdateSystemGroup.GhostEntityMap;

#if UNITY_EDITOR || DEVELOPMENT_BUILD
        var ghostMinMaxSnapshotTick = m_GhostUpdateSystemGroup.GhostSnapshotTickMinMax;
#endif
        if (!m_predictedQuery.IsEmptyIgnoreFilter)
        {
            var updatePredictedJob = new UpdatePredictedJob
            {
                GhostMap = ghostEntityMap,
#if UNITY_EDITOR || DEVELOPMENT_BUILD
                minMaxSnapshotTick = ghostMinMaxSnapshotTick,
#endif
                minPredictedTick                  = m_GhostPredictionSystemGroup.OldestPredictedTick,
                ghostSnapshotDataType             = GetBufferTypeHandle <CarStubSnapshotData>(true),
                ghostEntityType                   = GetEntityTypeHandle(),
                predictedGhostComponentType       = GetComponentTypeHandle <PredictedGhostComponent>(),
                ghostHealthComponentType          = GetComponentTypeHandle <HealthComponent>(),
                ghostProgressionComponentType     = GetComponentTypeHandle <ProgressionComponent>(),
                ghostSynchronizedCarComponentType = GetComponentTypeHandle <SynchronizedCarComponent>(),
                ghostRotationType                 = GetComponentTypeHandle <Rotation>(),
                ghostTranslationType              = GetComponentTypeHandle <Translation>(),

                targetTick        = m_ClientSimulationSystemGroup.ServerTick,
                lastPredictedTick = m_LastPredictedTick
            };
            m_LastPredictedTick = m_ClientSimulationSystemGroup.ServerTick;
            if (m_ClientSimulationSystemGroup.ServerTickFraction < 1)
            {
                m_LastPredictedTick = 0;
            }
            inputDeps = updatePredictedJob.Schedule(m_predictedQuery, JobHandle.CombineDependencies(inputDeps, m_GhostUpdateSystemGroup.LastGhostMapWriter));
            m_GhostPredictionSystemGroup.AddPredictedTickWriter(inputDeps);
        }
        if (!m_interpolatedQuery.IsEmptyIgnoreFilter)
        {
            var updateInterpolatedJob = new UpdateInterpolatedJob
            {
                GhostMap = ghostEntityMap,
#if UNITY_EDITOR || DEVELOPMENT_BUILD
                minMaxSnapshotTick = ghostMinMaxSnapshotTick,
#endif
                ghostSnapshotDataType             = GetBufferTypeHandle <CarStubSnapshotData>(true),
                ghostEntityType                   = GetEntityTypeHandle(),
                ghostHealthComponentType          = GetComponentTypeHandle <HealthComponent>(),
                ghostProgressionComponentType     = GetComponentTypeHandle <ProgressionComponent>(),
                ghostSynchronizedCarComponentType = GetComponentTypeHandle <SynchronizedCarComponent>(),
                ghostRotationType                 = GetComponentTypeHandle <Rotation>(),
                ghostTranslationType              = GetComponentTypeHandle <Translation>(),
                targetTick         = m_ClientSimulationSystemGroup.InterpolationTick,
                targetTickFraction = m_ClientSimulationSystemGroup.InterpolationTickFraction
            };
            inputDeps = updateInterpolatedJob.Schedule(m_interpolatedQuery, JobHandle.CombineDependencies(inputDeps, m_GhostUpdateSystemGroup.LastGhostMapWriter));
        }
        return(inputDeps);
    }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        if (!m_predictedQuery.IsEmptyIgnoreFilter)
        {
            var updatePredictedJob = new UpdatePredictedJob
            {
                GhostMap = m_ghostEntityMap,
#if UNITY_EDITOR || DEVELOPMENT_BUILD
                minMaxSnapshotTick = m_ghostMinMaxSnapshotTick,
#endif
                minPredictedTick            = m_GhostPredictionSystemGroup.OldestPredictedTick,
                ghostSnapshotDataType       = GetArchetypeChunkBufferType <BArcherSnapshotData>(true),
                ghostEntityType             = GetArchetypeChunkEntityType(),
                predictedGhostComponentType = GetArchetypeChunkComponentType <PredictedGhostComponent>(),
                ghostHealthType             = GetArchetypeChunkComponentType <Health>(),
                ghostPlayerUnitType         = GetArchetypeChunkComponentType <PlayerUnit>(),
                ghostUnitSelectionStateType = GetArchetypeChunkComponentType <UnitSelectionState>(),
                ghostLinkedEntityGroupType  = GetArchetypeChunkBufferType <LinkedEntityGroup>(true),
                ghostRotationFromEntity     = GetComponentDataFromEntity <Rotation>(),
                ghostTranslationFromEntity  = GetComponentDataFromEntity <Translation>(),

                targetTick        = m_ClientSimulationSystemGroup.ServerTick,
                lastPredictedTick = m_LastPredictedTick
            };
            m_LastPredictedTick = m_ClientSimulationSystemGroup.ServerTick;
            if (m_ClientSimulationSystemGroup.ServerTickFraction < 1)
            {
                m_LastPredictedTick = 0;
            }
            inputDeps = updatePredictedJob.Schedule(m_predictedQuery, JobHandle.CombineDependencies(inputDeps, m_GhostUpdateSystemGroup.LastGhostMapWriter));
            m_GhostPredictionSystemGroup.AddPredictedTickWriter(inputDeps);
        }
        if (!m_interpolatedQuery.IsEmptyIgnoreFilter)
        {
            var updateInterpolatedJob = new UpdateInterpolatedJob
            {
                GhostMap = m_ghostEntityMap,
#if UNITY_EDITOR || DEVELOPMENT_BUILD
                minMaxSnapshotTick = m_ghostMinMaxSnapshotTick,
#endif
                ghostSnapshotDataType       = GetArchetypeChunkBufferType <BArcherSnapshotData>(true),
                ghostEntityType             = GetArchetypeChunkEntityType(),
                ghostHealthType             = GetArchetypeChunkComponentType <Health>(),
                ghostPlayerUnitType         = GetArchetypeChunkComponentType <PlayerUnit>(),
                ghostUnitSelectionStateType = GetArchetypeChunkComponentType <UnitSelectionState>(),
                ghostLinkedEntityGroupType  = GetArchetypeChunkBufferType <LinkedEntityGroup>(true),
                ghostRotationFromEntity     = GetComponentDataFromEntity <Rotation>(),
                ghostTranslationFromEntity  = GetComponentDataFromEntity <Translation>(),
                targetTick         = m_ClientSimulationSystemGroup.InterpolationTick,
                targetTickFraction = m_ClientSimulationSystemGroup.InterpolationTickFraction
            };
            inputDeps = updateInterpolatedJob.Schedule(m_interpolatedQuery, JobHandle.CombineDependencies(inputDeps, m_GhostUpdateSystemGroup.LastGhostMapWriter));
        }
        return(inputDeps);
    }
Exemplo n.º 3
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var ghostEntityMap = m_GhostUpdateSystemGroup.GhostEntityMap;

#if UNITY_EDITOR || DEVELOPMENT_BUILD
        var ghostMinMaxSnapshotTick = m_GhostUpdateSystemGroup.GhostSnapshotTickMinMax;
#endif
        if (!m_predictedQuery.IsEmptyIgnoreFilter)
        {
            var updatePredictedJob = new UpdatePredictedJob
            {
                GhostMap = ghostEntityMap,
#if UNITY_EDITOR || DEVELOPMENT_BUILD
                minMaxSnapshotTick = ghostMinMaxSnapshotTick,
#endif
                minPredictedTick            = m_GhostPredictionSystemGroup.OldestPredictedTick,
                ghostSnapshotDataType       = GetArchetypeChunkBufferType <CharacterSnapshotData>(true),
                ghostEntityType             = GetArchetypeChunkEntityType(),
                predictedGhostComponentType = GetArchetypeChunkComponentType <PredictedGhostComponent>(),

                targetTick        = m_ClientSimulationSystemGroup.ServerTick,
                lastPredictedTick = m_LastPredictedTick
            };
            m_LastPredictedTick = m_ClientSimulationSystemGroup.ServerTick;
            if (m_ClientSimulationSystemGroup.ServerTickFraction < 1)
            {
                m_LastPredictedTick = 0;
            }
            inputDeps = updatePredictedJob.Schedule(m_predictedQuery, JobHandle.CombineDependencies(inputDeps, m_GhostUpdateSystemGroup.LastGhostMapWriter));
            m_GhostPredictionSystemGroup.AddPredictedTickWriter(inputDeps);
        }
        if (!m_interpolatedQuery.IsEmptyIgnoreFilter)
        {
            var updateInterpolatedJob = new UpdateInterpolatedJob
            {
                GhostMap = ghostEntityMap,
#if UNITY_EDITOR || DEVELOPMENT_BUILD
                minMaxSnapshotTick = ghostMinMaxSnapshotTick,
#endif
                ghostSnapshotDataType = GetArchetypeChunkBufferType <CharacterSnapshotData>(true),
                ghostEntityType       = GetArchetypeChunkEntityType(),
                ghostAttackType       = GetArchetypeChunkComponentType <Attack>(),
                ghostDamageType       = GetArchetypeChunkComponentType <Damage>(),
                ghostMovableCharacterComponentType = GetArchetypeChunkComponentType <MovableCharacterComponent>(),
                ghostPlayerDataType    = GetArchetypeChunkComponentType <PlayerData>(),
                ghostPrefabCreatorType = GetArchetypeChunkComponentType <PrefabCreator>(),
                ghostTranslationType   = GetArchetypeChunkComponentType <Translation>(),
                targetTick             = m_ClientSimulationSystemGroup.InterpolationTick,
                targetTickFraction     = m_ClientSimulationSystemGroup.InterpolationTickFraction
            };
            inputDeps = updateInterpolatedJob.Schedule(m_interpolatedQuery, JobHandle.CombineDependencies(inputDeps, m_GhostUpdateSystemGroup.LastGhostMapWriter));
        }
        return(inputDeps);
    }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        if (!m_predictedQuery.IsEmptyIgnoreFilter)
        {
            var updatePredictedJob = new UpdatePredictedJob
            {
                GhostMap = m_ghostEntityMap,
#if UNITY_EDITOR || DEVELOPMENT_BUILD
                minMaxSnapshotTick = m_ghostMinMaxSnapshotTick,
#endif
                minPredictedTick                 = m_GhostPredictionSystemGroup.OldestPredictedTick,
                ghostSnapshotDataType            = GetArchetypeChunkBufferType <Char_TerraformerSnapshotData>(true),
                ghostEntityType                  = GetArchetypeChunkEntityType(),
                predictedGhostComponentType      = GetArchetypeChunkComponentType <PredictedGhostComponent>(),
                ghostCharacterPredictedDataType  = GetArchetypeChunkComponentType <Character.PredictedData>(),
                ghostCharacterReplicatedDataType = GetArchetypeChunkComponentType <Character.ReplicatedData>(),
                ghostCharacterControllerGroundSupportDataType = GetArchetypeChunkComponentType <CharacterControllerGroundSupportData>(),
                ghostCharacterControllerMoveResultType        = GetArchetypeChunkComponentType <CharacterControllerMoveResult>(),
                ghostCharacterControllerVelocityType          = GetArchetypeChunkComponentType <CharacterControllerVelocity>(),
                ghostHealthStateDataType                        = GetArchetypeChunkComponentType <HealthStateData>(),
                ghostInventoryStateType                         = GetArchetypeChunkComponentType <Inventory.State>(),
                ghostPlayerOwnerPlayerIdType                    = GetArchetypeChunkComponentType <Player.OwnerPlayerId>(),
                ghostPlayerControlledStateType                  = GetArchetypeChunkComponentType <PlayerControlled.State>(),
                ghostLinkedEntityGroupType                      = GetArchetypeChunkBufferType <LinkedEntityGroup>(true),
                ghostAbilityAbilityControlFromEntity            = GetComponentDataFromEntity <Ability.AbilityControl>(),
                ghostAbilityMovementInterpolatedStateFromEntity = GetComponentDataFromEntity <AbilityMovement.InterpolatedState>(),
                ghostAbilityMovementPredictedStateFromEntity    = GetComponentDataFromEntity <AbilityMovement.PredictedState>(),
                ghostAbilitySprintPredictedStateFromEntity      = GetComponentDataFromEntity <AbilitySprint.PredictedState>(),

                targetTick        = m_ClientSimulationSystemGroup.ServerTick,
                lastPredictedTick = m_LastPredictedTick
            };
            m_LastPredictedTick = m_ClientSimulationSystemGroup.ServerTick;
            if (m_ClientSimulationSystemGroup.ServerTickFraction < 1)
            {
                m_LastPredictedTick = 0;
            }
            inputDeps = updatePredictedJob.Schedule(m_predictedQuery, JobHandle.CombineDependencies(inputDeps, m_GhostUpdateSystemGroup.LastGhostMapWriter));
            m_GhostPredictionSystemGroup.AddPredictedTickWriter(inputDeps);
        }
        if (!m_interpolatedQuery.IsEmptyIgnoreFilter)
        {
            var updateInterpolatedJob = new UpdateInterpolatedJob
            {
                GhostMap = m_ghostEntityMap,
#if UNITY_EDITOR || DEVELOPMENT_BUILD
                minMaxSnapshotTick = m_ghostMinMaxSnapshotTick,
#endif
                ghostSnapshotDataType = GetArchetypeChunkBufferType <Char_TerraformerSnapshotData>(true),
                ghostEntityType       = GetArchetypeChunkEntityType(),
                ghostCharacterInterpolatedDataType            = GetArchetypeChunkComponentType <Character.InterpolatedData>(),
                ghostCharacterReplicatedDataType              = GetArchetypeChunkComponentType <Character.ReplicatedData>(),
                ghostCharacterControllerGroundSupportDataType = GetArchetypeChunkComponentType <CharacterControllerGroundSupportData>(),
                ghostCharacterControllerMoveResultType        = GetArchetypeChunkComponentType <CharacterControllerMoveResult>(),
                ghostCharacterControllerVelocityType          = GetArchetypeChunkComponentType <CharacterControllerVelocity>(),
                ghostHealthStateDataType                        = GetArchetypeChunkComponentType <HealthStateData>(),
                ghostInventoryStateType                         = GetArchetypeChunkComponentType <Inventory.State>(),
                ghostPlayerOwnerPlayerIdType                    = GetArchetypeChunkComponentType <Player.OwnerPlayerId>(),
                ghostPlayerControlledStateType                  = GetArchetypeChunkComponentType <PlayerControlled.State>(),
                ghostLinkedEntityGroupType                      = GetArchetypeChunkBufferType <LinkedEntityGroup>(true),
                ghostAbilityAbilityControlFromEntity            = GetComponentDataFromEntity <Ability.AbilityControl>(),
                ghostAbilityMovementInterpolatedStateFromEntity = GetComponentDataFromEntity <AbilityMovement.InterpolatedState>(),
                ghostAbilityMovementPredictedStateFromEntity    = GetComponentDataFromEntity <AbilityMovement.PredictedState>(),
                ghostAbilitySprintPredictedStateFromEntity      = GetComponentDataFromEntity <AbilitySprint.PredictedState>(),
                targetTick         = m_ClientSimulationSystemGroup.InterpolationTick,
                targetTickFraction = m_ClientSimulationSystemGroup.InterpolationTickFraction
            };
            inputDeps = updateInterpolatedJob.Schedule(m_interpolatedQuery, JobHandle.CombineDependencies(inputDeps, m_GhostUpdateSystemGroup.LastGhostMapWriter));
        }
        return(inputDeps);
    }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        if (!m_predictedQuery.IsEmptyIgnoreFilter)
        {
            var updatePredictedJob = new UpdatePredictedJob
            {
                GhostMap = m_ghostEntityMap,
#if UNITY_EDITOR || DEVELOPMENT_BUILD
                minMaxSnapshotTick = m_ghostMinMaxSnapshotTick,
#endif
                minPredictedTick            = m_GhostPredictionSystemGroup.OldestPredictedTick,
                ghostSnapshotDataType       = GetArchetypeChunkBufferType <__GHOST_NAME__SnapshotData>(true),
                ghostEntityType             = GetArchetypeChunkEntityType(),
                predictedGhostComponentType = GetArchetypeChunkComponentType <PredictedGhostComponent>(),
                #region __GHOST_PREDICTED_ASSIGN_COMPONENT_REF__
                ghost__GHOST_COMPONENT_TYPE_NAME__Type = GetArchetypeChunkComponentType <__GHOST_COMPONENT_TYPE__>(),
                #endregion
                #region __GHOST_PREDICTED_ASSIGN_BUFFER_REF__
                ghost__GHOST_COMPONENT_TYPE_NAME__Type = GetArchetypeChunkBufferType <__GHOST_COMPONENT_TYPE__>(true),
                #endregion
                #region __GHOST_PREDICTED_ASSIGN_COMPONENT_CHILD_REF__
                ghost__GHOST_COMPONENT_FROM_ENTITY_NAME__FromEntity = GetComponentDataFromEntity <__GHOST_COMPONENT_TYPE__>(),
                #endregion

                targetTick        = m_ClientSimulationSystemGroup.ServerTick,
                lastPredictedTick = m_LastPredictedTick
            };
            m_LastPredictedTick = m_ClientSimulationSystemGroup.ServerTick;
            if (m_ClientSimulationSystemGroup.ServerTickFraction < 1)
            {
                m_LastPredictedTick = 0;
            }
            inputDeps = updatePredictedJob.Schedule(m_predictedQuery, JobHandle.CombineDependencies(inputDeps, m_GhostUpdateSystemGroup.LastGhostMapWriter));
            m_GhostPredictionSystemGroup.AddPredictedTickWriter(inputDeps);
        }
        if (!m_interpolatedQuery.IsEmptyIgnoreFilter)
        {
            var updateInterpolatedJob = new UpdateInterpolatedJob
            {
                GhostMap = m_ghostEntityMap,
#if UNITY_EDITOR || DEVELOPMENT_BUILD
                minMaxSnapshotTick = m_ghostMinMaxSnapshotTick,
#endif
                ghostSnapshotDataType = GetArchetypeChunkBufferType <__GHOST_NAME__SnapshotData>(true),
                ghostEntityType       = GetArchetypeChunkEntityType(),
                #region __GHOST_INTERPOLATED_ASSIGN_COMPONENT_REF__
                ghost__GHOST_COMPONENT_TYPE_NAME__Type = GetArchetypeChunkComponentType <__GHOST_COMPONENT_TYPE__>(),
                #endregion
                #region __GHOST_INTERPOLATED_ASSIGN_BUFFER_REF__
                ghost__GHOST_COMPONENT_TYPE_NAME__Type = GetArchetypeChunkBufferType <__GHOST_COMPONENT_TYPE__>(true),
                #endregion
                #region __GHOST_INTERPOLATED_ASSIGN_COMPONENT_CHILD_REF__
                ghost__GHOST_COMPONENT_FROM_ENTITY_NAME__FromEntity = GetComponentDataFromEntity <__GHOST_COMPONENT_TYPE__>(),
                #endregion
                targetTick         = m_ClientSimulationSystemGroup.InterpolationTick,
                targetTickFraction = m_ClientSimulationSystemGroup.InterpolationTickFraction
            };
            inputDeps = updateInterpolatedJob.Schedule(m_interpolatedQuery, JobHandle.CombineDependencies(inputDeps, m_GhostUpdateSystemGroup.LastGhostMapWriter));
        }
        return(inputDeps);
    }