Exemplo n.º 1
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            NativeArray <CharaDelta> charaDeltas = m_query.ToComponentDataArray <CharaDelta>(Allocator.TempJob);
            NativeArray <CharaDash>  charaDashes = m_query.ToComponentDataArray <CharaDash>(Allocator.TempJob);
            NativeArray <CharaFlag>  charaFlags  = m_query.ToComponentDataArray <CharaFlag>(Allocator.TempJob);
            NativeArray <PadScan>    padScans    = m_query.ToComponentDataArray <PadScan>(Allocator.TempJob);

            var job = new MoveJob()
            {
                m_charaDeltas = charaDeltas,
                m_charaDashes = charaDashes,
                m_charaFlags  = charaFlags,
                m_padScans    = padScans,
                BrakeDelta    = Settings.Instance.Move.BrakeDelta,
                WalkSpeed     = Settings.Instance.Move.WalkSpeed,
                DashSpeed     = Settings.Instance.Move.DashSpeed,
            };

            inputDeps = job.Schedule(inputDeps);
            inputDeps.Complete();

            m_query.CopyFromComponentDataArray(job.m_charaDeltas);

            charaDeltas.Dispose();
            charaDashes.Dispose();
            charaFlags.Dispose();
            padScans.Dispose();

            return(inputDeps);
        }
Exemplo n.º 2
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            m_queryField.AddDependency(inputDeps);

            NativeArray <FieldInput>  fieldInputs  = m_queryField.ToComponentDataArray <FieldInput>(Allocator.TempJob);
            NativeArray <FieldScan>   fieldScans   = m_queryField.ToComponentDataArray <FieldScan>(Allocator.TempJob);
            NativeArray <FieldBanish> fieldBanishs = m_queryField.ToComponentDataArray <FieldBanish>(Allocator.TempJob);
            var job = new MoveJob()
            {
                fieldInputs            = fieldInputs,
                fieldScans             = fieldScans,
                fieldBanishs           = fieldBanishs,
                SwipeThreshold         = Settings.Instance.Common.SwipeThreshold,
                GridSize               = Settings.Instance.Common.GridSize,
                BorderSpeed            = Settings.Instance.Common.BorderSpeed,
                BorderOnGridDist       = Settings.Instance.Common.BorderOnGridDist,
                PixelSize              = Settings.Instance.PixelSize,
                FieldWidth             = Settings.Instance.Common.FieldWidth,
                FieldHeight            = Settings.Instance.Common.FieldHeight,
                offsetConvertPositionX = m_offsetConvertPositionX,
                offsetConvertPositionY = m_offsetConvertPositionY,
            };

            inputDeps = job.Schedule(inputDeps);
            inputDeps.Complete();
            m_queryField.CopyFromComponentDataArray(job.fieldInputs);

            fieldInputs.Dispose();
            fieldScans.Dispose();
            fieldBanishs.Dispose();

            return(inputDeps);
        }
Exemplo n.º 3
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var settings = GetSingleton <SettingsComponent>();

            if (_positionsQuery.CalculateEntityCount() == settings.Width * settings.Height)
            {
                return(inputDeps);
            }

            var helper = new ArrayHelper(settings.Width, settings.Height);

            var cachedEntities = new NativeArray <Entity>(settings.Width * settings.Height, Allocator.TempJob);

            var cacheJob = new CacheJob
            {
                CachedEntities = cachedEntities,
                Entities       = _positionsQuery.ToEntityArray(Allocator.TempJob),
                Positions      = _positionsQuery.ToComponentDataArray <PositionComponent>(Allocator.TempJob),
                Helper         = helper
            };

            var jobHandle = cacheJob.Schedule(_positionsQuery.CalculateEntityCount(), 32, inputDeps);

            var moveJob = new MoveJob
            {
                CachedEntities = cachedEntities,
                Position       = GetComponentDataFromEntity <PositionComponent>(),
                Helper         = helper
            };

            jobHandle = moveJob.Schedule(jobHandle);


            return(jobHandle);
        }
Exemplo n.º 4
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var moveJob = new MoveJob {
            };

            return(moveJob.Schedule(this, inputDeps));
        }
Exemplo n.º 5
0
    private void Update()
    {
        var boundsJob = new BoundsJob()
        {
            Positions     = _positions,
            Accelerations = _accelerations,
            AreaSize      = _areaSize
        };
        var accelerationJob = new AccelerationJob()
        {
            Positions            = _positions,
            Velocities           = _velocities,
            Accelerations        = _accelerations,
            DestinationThreshold = _destinationThreshold,
            Weights = _accelerationWeights
        };
        var moveJob = new MoveJob()
        {
            Positions     = _positions,
            Velocities    = _velocities,
            Accelerations = _accelerations,
            DeltaTime     = Time.deltaTime,
            VelocityLimit = _velocityLimit
        };
        var boundsHandle       = boundsJob.Schedule(_numberOfEntities, 0);
        var accelerationHandle = accelerationJob.Schedule(_numberOfEntities,
                                                          0, boundsHandle);
        var moveHandle = moveJob.Schedule(_transformAccessArray, accelerationHandle);

        moveHandle.Complete();
    }
Exemplo n.º 6
0
        protected override JobHandle OnUpdate(JobHandle handle)
        {
            var moveJob = new MoveJob {
                DeltaTime = Time.deltaTime,
            };

            return(moveJob.Schedule(this, handle));
        }
Exemplo n.º 7
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            MoveJob renderJob = new MoveJob {
                DeltaTime = Time.deltaTime
            };

            return(renderJob.Schedule(this, inputDeps));
        }
    // OnUpdate which returns a JobHandle - thread
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var jobHandle = new MoveJob {
        };                                              // Create the Job

        jobHandle.Schedule(this, inputDeps).Complete(); // Schedule and Complete Straight Away

        return(inputDeps);                              // Return a job handle
    }
Exemplo n.º 9
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new MoveJob
        {
            deltaTime = Time.deltaTime
        };

        return(job.Schedule(this, inputDeps));
    }
Exemplo n.º 10
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new MoveJob {
            data = data,
            dt   = Time.deltaTime
        };

        return(job.Schedule(data.Length, 32, inputDeps));
    }
Exemplo n.º 11
0
    private void Update()
    {
        // Just creating the job will NOT execute the job on Update
        moveJob = new MoveJob {
        };

        // Call all transforms in the TransformAccessArray to schedule MoveJob
        moveHandle = moveJob.Schedule(transforms);
    }
Exemplo n.º 12
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        MoveJob mj = new MoveJob()
        {
            deltaTimeFromMainThread = Time.fixedDeltaTime
        };
        JobHandle moveHandle = mj.Schedule(this, inputDeps);

        return(moveHandle);
    }
Exemplo n.º 13
0
        protected override JobHandle HandleMessage(JobHandle handle, EntityCommandBuffer commandBuffer)
        {
            var moveJob = new MoveJob {
                CommandBuffer = commandBuffer,
                Receivers     = Receivers,
                Payloads      = Payloads,
            };

            return(moveJob.Schedule(this, handle));
        }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        MoveJob tMoveJob = new MoveJob
        {
            m_TranslationChunk   = GetArchetypeChunkComponentType <Translation>(),
            m_MoveComponentChunk = GetArchetypeChunkComponentType <C_MoveComponent>()
        };

        return(tMoveJob.Schedule(m_EntityQuery, inputDeps));
    }
Exemplo n.º 15
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        MoveJob job = new MoveJob {
            deltaTime = Time.fixedDeltaTime
        };

        JobHandle jobHandle = job.Schedule(this, inputDeps);

        return(jobHandle);
    }
Exemplo n.º 16
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new MoveJob
        {
            Dt = Time.deltaTime,
            HorizontalLimit = Bootstrap.HorizontalLimit
        };

        return(job.Schedule(this, 1, inputDeps));
    }
        protected override JobHandle OnUpdate(JobHandle jobDeps)
        {
            MoveJob job = new MoveJob()
            {
                Buffer = BufferSystem.CreateCommandBuffer().ToConcurrent(),
                Center = GetComponentDataFromEntity <PiecePosition>(true)
            };

            return(job.Schedule(this, jobDeps));
        }
Exemplo n.º 18
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var job = new MoveJob()
            {
                time = Time.timeSinceLevelLoad
            };
            var handle = job.Schedule(this);

            return(handle);
        }
Exemplo n.º 19
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new MoveJob()
        {
            AnimationType = GetArchetypeChunkComponentType <AnimatorComponent>(false),
            ElapsedTime   = Time.ElapsedTime
        };

        return(job.Schedule(m_Group, inputDeps));
    }
Exemplo n.º 20
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var neighbors = new NeighborsDetectionJob
            {
                prodThresh          = math.cos(math.radians(Bootstrap.Param.neighborFov)),
                distThresh          = Bootstrap.Param.neighborDistance,
                neighborsFromEntity = GetBufferFromEntity <NeighborsEntityBuffer>(false),
                positionFromEntity  = GetComponentDataFromEntity <Position>(true),
                entities            = group.GetEntityArray(),
            };

            var wall = new WallJob
            {
                scale  = Bootstrap.Param.wallScale * 0.5f,
                thresh = Bootstrap.Param.wallDistance,
                weight = Bootstrap.Param.wallWeight,
            };

            var separation = new SeparationJob
            {
                separationWeight    = Bootstrap.Param.separationWeight,
                neighborsFromEntity = GetBufferFromEntity <NeighborsEntityBuffer>(true),
                positionFromEntity  = GetComponentDataFromEntity <Position>(true),
            };

            var alignment = new AlignmentJob
            {
                alignmentWeight     = Bootstrap.Param.alignmentWeight,
                neighborsFromEntity = GetBufferFromEntity <NeighborsEntityBuffer>(true),
                velocityFromEntity  = GetComponentDataFromEntity <Velocity>(true),
            };

            var cohesion = new CohesionJob
            {
                cohesionWeight      = Bootstrap.Param.cohesionWeight,
                neighborsFromEntity = GetBufferFromEntity <NeighborsEntityBuffer>(true),
                positionFromEntity  = GetComponentDataFromEntity <Position>(true),
            };

            var move = new MoveJob
            {
                dt       = Time.deltaTime,
                minSpeed = Bootstrap.Param.minSpeed,
                maxSpeed = Bootstrap.Param.maxSpeed,
            };

            inputDeps = neighbors.Schedule(this, inputDeps);
            inputDeps = wall.Schedule(this, inputDeps);
            inputDeps = separation.Schedule(this, inputDeps);
            inputDeps = alignment.Schedule(this, inputDeps);
            inputDeps = cohesion.Schedule(this, inputDeps);
            inputDeps = move.Schedule(this, inputDeps);
            return(inputDeps);
        }
Exemplo n.º 21
0
    protected override JobHandle OnUpdate(JobHandle inputDependencies)
    {
        var job = new MoveJob()
        {
            deltaTime = Time.deltaTime,
            wallMap   = new NativeArray <bool>(GameManager.wallMap, Allocator.TempJob),
            rand      = new Random((uint)UnityEngine.Random.Range(0, 10000000))
        };

        return(job.Schedule(this, inputDependencies));
    }
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            MoveJob moveJob = new MoveJob
            {
                deltaTime = Time.deltaTime
            };

            JobHandle moveHandle = moveJob.Schedule(this, inputDeps);

            return(moveHandle);
        }
Exemplo n.º 23
0
    public override void OnUpdate(float deltaTime)
    {
        var newJob = new MoveJob {
            moveVector = this.moveVector
        };

        var handle = newJob.Schedule(this.transforms);

        JobHandle.ScheduleBatchedJobs();
        handle.Complete();
    }
Exemplo n.º 24
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        MoveJob moveJob = new MoveJob
        {
            vec3CometPosition = GameManager.instance.Comet.position,
            deltaTime         = Time.deltaTime,
        };

        JobHandle moveHandle = moveJob.Schedule(this, inputDeps);

        return(moveHandle);
    }
Exemplo n.º 25
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new MoveJob()
        {
            TranslationType     = GetArchetypeChunkComponentType <Translation>(false),
            MoveBySpeedDataType = GetArchetypeChunkComponentType <MoveBySpeedData>(true),
            WaveDataType        = GetArchetypeChunkComponentType <WaveData>(true),
            ElapsedTime         = Time.ElapsedTime
        };

        return(job.Schedule(m_Group, inputDeps));
    }
Exemplo n.º 26
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var job = new MoveJob()
            {
                time = Time.timeSinceLevelLoad
            };

            return(job.Schedule(this, inputDeps)); //schedules parallel for jobs

            //*****execute in a single job************
            //return job.ScheduleSingle(this, inputDeps);
        }
Exemplo n.º 27
0
        protected override void OnUpdate()
        {
            var job = new MoveJob()
            {
                DeltaTime       = Time.DeltaTime,
                TranslationType = GetComponentTypeHandle <Translation>(),
                SpeedType       = GetComponentTypeHandle <Speed>(),
                DestinationType = GetComponentTypeHandle <Destination>()
            };

            Dependency = job.Schedule(_destinationQuery, Dependency);
        }
Exemplo n.º 28
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        if (GetSingleton <GamePause>().IsOn)
        {
            return(inputDeps);
        }

        MoveJob job = new MoveJob {
            DeltaTime = Time.DeltaTime
        };

        return(job.Schedule(this, inputDeps));
    }
Exemplo n.º 29
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new MoveJob
        {
            query        = NavMeshQuery,
            navAgent     = AgentsGroup.ToComponentDataArray <NavAgent>(Allocator.TempJob),
            localToWorld = AgentsGroup.ToComponentDataArray <LocalToWorld>(Allocator.TempJob)
                           //Translations = AgentsGroup.ToComponentDataArray<Translation>(Allocator.TempJob),
                           //PathStatus =new NativeArray<PathQueryStatus>(1, Allocator.TempJob)
        };
        var hand = job.Schedule(inputDeps);

        return(hand);
    }
Exemplo n.º 30
0
    private void Update()
    {
        moveJob    = new MoveJob {
        };
        moveHandle = moveJob.Schedule(transforms);


        //for (int i = 0; i < numSheep; i++)
        //{
        //    allSheep[i].transform.Translate(0, 0, 0.1f);
        //    if (allSheep[i].transform.position.z > 50)
        //    {
        //        allSheep[i].transform.position = new Vector3(allSheep[i].transform.position.x, 0, -50);
        //    }
        //}
    }