Example #1
0
    // OnUpdate runs on the main thread.
    protected override JobHandle OnUpdate(JobHandle inputDependencies)
    {
        var job = new RotationSpeedJob
        {
            DeltaTime = Time.deltaTime
        };

        return(job.Schedule(this, inputDependencies));
    }
Example #2
0
        protected override JobHandle OnUpdate(JobHandle inputDependencies)
        {
            var job = new RotationSpeedJob()
            {
                RotationType      = GetArchetypeChunkComponentType <Rotation>(false),
                RotationSpeedType = GetArchetypeChunkComponentType <RotationSpeed>(true),
                DeltaTime         = Time.DeltaTime
            };

            return(job.Schedule(m_Query, inputDependencies));
        }
Example #3
0
        protected override void OnUpdate()
        {
            var job = new RotationSpeedJob()
            {
                RotationTypeHandle      = GetComponentTypeHandle <Rotation>(false),
                RotationSpeedTypeHandle = GetComponentTypeHandle <RotationSpeed>(true),
                DeltaTime = Time.DeltaTime
            };

            this.Dependency = job.ScheduleParallel(m_Query, this.Dependency);
        }
Example #4
0
        // OnUpdate runs on the main thread.
        protected override JobHandle OnUpdate(JobHandle inputDependencies)
        {
            var job = new RotationSpeedJob()
            {
                DeltaTime          = Time.deltaTime,
                rightDeplacement   = Input.GetKey(KeyCode.RightArrow),
                leftDeplacement    = Input.GetKey(KeyCode.LeftArrow),
                forwardDeplacement = Input.GetKey(KeyCode.UpArrow),
                backDeplacement    = Input.GetKey(KeyCode.DownArrow),
            };

            return(job.Schedule(this, inputDependencies));
        }
Example #5
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            ArchetypeChunkComponentType <Rotation>      rotationType      = GetArchetypeChunkComponentType <Rotation>();
            ArchetypeChunkComponentType <RotationSpeed> rotationSpeedType =
                GetArchetypeChunkComponentType <RotationSpeed>(true);
            var job = new RotationSpeedJob
            {
                DeltaTime         = Time.deltaTime,
                RotationType      = rotationType,
                RotationSpeedType = rotationSpeedType
            };

            return(job.Schedule(_group, inputDeps));
        }
Example #6
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var rotationType      = GetArchetypeChunkComponentType <Rotation>();
            var rotationSpeedType = GetArchetypeChunkComponentType <RotationSpeedComponent>();

            var job = new RotationSpeedJob()
            {
                DeltaTime    = Time.DeltaTime,
                RotationType = rotationType,
                RotationSpeedComponentType = rotationSpeedType
            };

            return(job.Schedule(entityQuery, inputDeps));
        }
Example #7
0
    //同样这个OnUpdate方法还是在主线程执行的
    protected override JobHandle OnUpdate(JobHandle inputDependencies)
    {
        var rotationType      = GetArchetypeChunkComponentType <Rotation>();                    //可读写组件块
        var rotationSpeedType = GetArchetypeChunkComponentType <RotationSpeed_IJobChunk>(true); //参数表示是否只读,默认是false,这个这个RotationSpeed_IJobChunk组件只是数据配置组件,不需要修改,所以参数为只读 true

        //实例化出JobChunk对象
        var job = new RotationSpeedJob()
        {
            RotationType      = rotationType,
            RotationSpeedType = rotationSpeedType,
            DeltaTime         = Time.DeltaTime
        };

        //将job提上日程
        return(job.Schedule(m_Group, inputDependencies));
    }
        // OnUpdate runs on the main thread.
        protected override JobHandle OnUpdate(JobHandle inputDependencies)
        {
            // Explicitly declare:
            // - Read-Write access to Rotation
            // - Read-Only access to RotationSpeed_IJobChunk
            var rotationType      = GetArchetypeChunkComponentType <Rotation>();
            var rotationSpeedType = GetArchetypeChunkComponentType <RotationSpeed_IJobChunk>(true);

            var job = new RotationSpeedJob()
            {
                RotationType      = rotationType,
                RotationSpeedType = rotationSpeedType,
                DeltaTime         = Time.DeltaTime
            };

            return(job.Schedule(m_Group, inputDependencies));
        }
Example #9
0
    // OnUpdate runs on the main thread.
    protected override void OnUpdate()
    {
        // Explicitly declare:
        // - Read-Write access to Rotation
        // - Read-Only access to RotationSpeed_IJobChunk
        var rotationType      = GetComponentTypeHandle <Rotation>();
        var rotationSpeedType = GetComponentTypeHandle <RotationSpeed_IJobEntityBatch>(true);

        var job = new RotationSpeedJob()
        {
            RotationTypeHandle      = rotationType,
            RotationSpeedTypeHandle = rotationSpeedType,
            DeltaTime = Time.DeltaTime
        };

        Dependency = job.ScheduleParallel(m_Query, 1, Dependency);
    }
    // OnUpdate runs on the main thread.
    protected override void OnUpdate()
    {
        // Explicitly declare:
        // - Read-Write access to Rotation
        // - Read-Only access to RotationSpeed_IJobChunk
        var rotationType      = GetArchetypeChunkComponentType <Rotation>();
        var rotationSpeedType = GetArchetypeChunkComponentType <RotationSpeed_IJobChunk>(true);

        var job = new RotationSpeedJob()
        {
            RotationType      = rotationType,
            RotationSpeedType = rotationSpeedType,
            DeltaTime         = Time.DeltaTime
        };

        Dependency = job.Schedule(m_Group, Dependency);
    }
Example #11
0
    public void OnUpdate(ref SystemState state)
    {
        // Explicitly declare:
        // - Read-Write access to Rotation
        // - Read-Only access to RotationSpeed_IJobChunkStructBased
        var rotationType      = state.GetComponentTypeHandle <Rotation>();
        var rotationSpeedType = state.GetComponentTypeHandle <RotationSpeed_IJobChunkStructBased>(true);

        var job = new RotationSpeedJob()
        {
            RotationTypeHandle      = rotationType,
            RotationSpeedTypeHandle = rotationSpeedType,
            DeltaTime = state.Time.DeltaTime
        };

        state.Dependency = job.ScheduleSingle(m_Group, state.Dependency);
    }