protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var copyBarrier = Setup(inputDeps);

        var collisionJob = new CollisionJob
        {
            Positions     = _positionsCopy,
            Sizes         = _sizeCopy,
            Entities      = _entitiesCopy,
            CommandBuffer = _barrierSystem.CreateCommandBuffer().ToConcurrent(),
            MaxPlayerSize = Bootstrap.Settings.PlayerMaxSize,
            Grid          = _gridSystem.Grid,
            CellSize      = Bootstrap.Settings.CellSize
        };

        var collisionJobHandle = collisionJob.Schedule(_mSpatialData.Length, 64, copyBarrier);

        var copySizesBackJob = new CopyArrayToComponentData <Size>
        {
            Source  = _sizeCopy,
            Results = _mSpatialData.Size
        };

        return(copySizesBackJob.Schedule(_mSpatialData.Length, 64, collisionJobHandle));
    }
Exemple #2
0
        protected override JobHandle OnUpdate(JobHandle inputDependencies)
        {
            var damageReceivers = GetComponentDataFromEntity <DamageIn>();
            var damageDealers   = GetComponentDataFromEntity <DamageOut>();

            var systemJob = new SystemJob()
            {
                CommandBuffer   = _collisionBarrierSystem.CreateCommandBuffer().ToConcurrent(),
                DamageReceivers = damageReceivers,
                DamageDealers   = damageDealers
            };

            inputDependencies = systemJob.Schedule(
                _stepPhysicsWorld.Simulation,
                ref _buildPhysicsWorldSystem.PhysicsWorld,
                inputDependencies);

            _collisionBarrierSystem.AddJobHandleForProducer(inputDependencies);

            return(inputDependencies);
        }