Beispiel #1
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        if (!HasSingleton <PlayerInput>())
        {
            return(inputDeps);
        }

        var emitDustJob = new EmitDust
        {
            deltaTime     = UnityEngine.Time.fixedDeltaTime,
            CommandBuffer = endSimulationEntityCommandBufferSystem.CreateCommandBuffer().ToConcurrent(),
            PlayerInput   = GetSingleton <PlayerInput>(),
            random        = (uint)Random.Range(0, 12345)
        };
        var emitDustHandle = emitDustJob.Schedule(this, inputDeps);

        endSimulationEntityCommandBufferSystem.AddJobHandleForProducer(emitDustHandle);

        var eyeJob = new AlignEyes
        {
            LocalToWorldDataFromEntity = GetComponentDataFromEntity <LocalToWorld>(),
        };
        var eyeHandle = eyeJob.Schedule(this, emitDustHandle);


        var job = new ScaleBodyJob
        {
            deltaTime = UnityEngine.Time.fixedDeltaTime,
            time      = Time.time
        };

        return(job.Schedule(this, eyeHandle));
    }
Beispiel #2
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            /*
             * if (!HasSingleton<PlayerInput>())
             *  return inputDeps;
             *
             * var emitDustJob = new EmitDust
             * {
             *  deltaTime = Time.deltaTime,
             *  CommandBuffer = endSimulationEntityCommandBufferSystem.CreateCommandBuffer().ToConcurrent(),
             *  PlayerInput = GetSingleton<PlayerInput>(),
             *  random = (uint)Random.Range(0,12345)
             * };
             * var emitDustHandle = emitDustJob.Schedule(this, inputDeps);
             * endSimulationEntityCommandBufferSystem.AddJobHandleForProducer(emitDustHandle);
             *
             * var eyeJob = new AlignEyes
             * {
             *  LocalToWorldDataFromEntity = GetComponentDataFromEntity<LocalToWorld>(),
             * };
             * var eyeHandle = eyeJob.Schedule(this, emitDustHandle);
             */
            var springRotationJob = new SpringJob
            {
                deltaTime = Time.deltaTime,
                time      = Time.time,
                Spring    = GetComponentDataFromEntity <Spring>(),
                Agent     = GetComponentDataFromEntity <Agent>(true)
            };
            var springRotationJobHandle = springRotationJob.Schedule(this, inputDeps);

            var scaleBodyJob = new ScaleBodyJob
            {
                deltaTime = Time.deltaTime,
                time      = Time.time
            };

            return(scaleBodyJob.Schedule(this, springRotationJobHandle));
        }