示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (batsEnabled)
        {
            moveHandle.Complete();

            if (Input.GetKeyDown("space"))
            {
                SpawnBat();
            }

            moveJob = new MovementJob()
            {
                moveSpeed   = moveSpeed,
                deltaTime   = Time.deltaTime,
                lowerBoundX = lowerBoundX,
                upperBoundX = upperBoundX,
                lowerBoundZ = lowerBoundZ,
                upperBoundZ = upperBoundZ,
                randomNums  = randNums
                              //randDirDeg = randDeg,
            };
            moveHandle = moveJob.Schedule(transforms);

            JobHandle.ScheduleBatchedJobs();
        }
    }
示例#2
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new MovementJob
        {
        };

        return(job.Schedule(this, inputDeps));
    }
示例#3
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var job = new MovementJob( )
            {
                deltaTime = Time.deltaTime
            };

            return(job.Schedule(this, 64, inputDeps));;
        }
示例#4
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        MovementJob moveJob = new MovementJob
        {
        };
        JobHandle moveHandle = moveJob.Schedule(this, inputDeps);

        return(moveHandle);
    }
示例#5
0
        protected override JobHandle OnUpdate(JobHandle inputDependencies)
        {
            var job = new MovementJob()
            {
                DeltaTime = UnityEngine.Time.deltaTime
            };

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

            return(moveJob.Schedule(this, inputDeps));
        }
示例#7
0
        public JobHandle ProcessMovementJob(float deltaTime, JobHandle inputDependencies = default(JobHandle))
        {
            MovementJob job = new MovementJob
            {
                DeltaTime = deltaTime
            };

            return(job.Schedule(this, inputDependencies));
        }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new MovementJob(endSimulation.CreateCommandBuffer().ToConcurrent(), Time.deltaTime);

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

        endSimulation.AddJobHandleForProducer(jobHandle);

        return(jobHandle);
    }
示例#9
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        MovementJob moveJob = new MovementJob();

        moveJob.positions = m_Group.positions;
        moveJob.rotations = m_Group.rotations;
        JobHandle moveHandle = moveJob.Schedule(m_Group.Length, 64, inputDeps);

        return(moveHandle);
    }
示例#10
0
    // Set up jobs per frame
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var mj = new MovementJob()
        {
            dt = 0.01f,
        };
        var h = mj.Schedule(this, inputDeps);

        return(h);
    }
        //private EntityArchetype arc;
        //
        //protected override void OnCreateManager()
        //{
        //    arc = EntityManager.CreateArchetype(typeof(Position), typeof(Test), typeof(Unity.Rendering.MeshInstanceRendererComponent));
        //}

        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            MovementJob job = new MovementJob
            {
                deltaTime = Time.deltaTime
            };

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

            return(handle);
        }
示例#12
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var job = new MovementJob {
                deltaTime     = Time.deltaTime,
                heightFactor  = AudioWaveProvider.Instance.CurrentWave,
                maxHeight     = AudioWaveProvider.Instance.MaxHeight,
                waveIntensity = AudioWaveProvider.Instance.WaveIntensity
            };

            return(job.Schedule(this, inputDeps));
        }
示例#13
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        MovementJob MJob = new MovementJob
        {
            DeltaTime = UnityEngine.Time.deltaTime,
        };

        JobHandle MoveHandle = MJob.Schedule(this, inputDeps);

        return(MoveHandle);
    }
示例#14
0
        private void Update()
        {
            var moveJob = new MovementJob {
                Position  = _position.AsDeferredJobArray(),
                Velocity  = _velocity.AsDeferredJobArray(),
                DeltaTime = Time.deltaTime,
                Area      = area
            };

            var moveHandler = moveJob.Schedule(_transform);

            moveHandler.Complete();
        }
示例#15
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            MovementJob moveJob = new MovementJob
            {
                topBound    = GameManager.GM.topBound,
                bottomBound = GameManager.GM.bottomBound,
                deltaTime   = Time.deltaTime
            };

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

            return(moveHandle);
        }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var gm      = GameManager_ECS.Instance;
        var moveJob = new MovementJob
        {
            topBound    = gm.topBound,
            buttonBound = gm.bottomBound,
            deltaTime   = Time.deltaTime,
        };

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

        return(moveHandle);
    }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new MovementJob
        {
            deltatime = Time.deltaTime
        };
        var jh        = job.Schedule(this, inputDeps);
        var jobScaled = new MovementScaledJob
        {
            deltatime = Time.deltaTime
        };

        return(jobScaled.Schedule(this, jh));
    }
示例#18
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        ComponentTypeHandle <Translation> translationType = GetComponentTypeHandle <Translation>();
        ComponentTypeHandle <Velocity>    velocityType    = GetComponentTypeHandle <Velocity>();

        MovementJob job = new MovementJob
        {
            TranslationType = translationType,
            VelocityType    = velocityType,
            dt = Time.DeltaTime
        };

        return(job.Schedule(m_Group, inputDeps));
    }
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var translationType = GetArchetypeChunkComponentType <Translation>();
            var movementType    = GetArchetypeChunkComponentType <MovementComponent>();

            var job = new MovementJob()
            {
                DeltaTime             = Time.DeltaTime,
                TranslationType       = translationType,
                MovementComponentType = movementType
            };

            return(job.Schedule(entityQuery, inputDeps));
        }
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            MovementJob moveJob = new MovementJob
            {
                randx     = GameManager.GM.getRandomX(),
                randz     = GameManager.GM.getRandomZ(),
                deltaTime = Time.deltaTime
            };


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

            return(moveHandle);
        }
示例#21
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            //Debug.Log("ECSWithJobSystemMethod");
            MovementJob moveJob = new MovementJob
            {
                topBound    = GameManager.GM.topBound,
                bottomBound = GameManager.GM.bottomBound,
                deltaTime   = Time.deltaTime
            };

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

            //moveHandle.Complete();
            return(moveHandle);
        }
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            MovementJob moveIt = new MovementJob
            {
                TopBound   = GameManagerECS.GM.TopLeftBound.transform.position.y,
                BotBound   = GameManagerECS.GM.BotRightBound.transform.position.y,
                LeftBound  = GameManagerECS.GM.TopLeftBound.transform.position.x,
                RightBound = GameManagerECS.GM.BotRightBound.transform.position.x,
                deltaTime  = Time.deltaTime
            };

            JobHandle moveHandle = moveIt.Schedule(this, 64, inputDeps);

            return(moveHandle);
        }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        MovementJob moveJob = new MovementJob
        {
            //topBound = ShipMovementManager.GM.topBound,
            //bottomBound = ShipMovementManager.GM.bottomBound,
            topBound    = ShipMovementManager.GM.WorldResetTop,
            bottomBound = ShipMovementManager.GM.WorldResetBottom,
            deltaTime   = Time.deltaTime
        };

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

        return(moveHandle);
    }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var heroTranslation = World.EntityManager.GetComponentData <Translation>(this.heroEntity);


        MovementJob movementJob = new MovementJob
        {
            HeroSpeed           = this.World.EntityManager.GetComponentData <CarComponent>(heroEntity).Speed,
            DeltaTime           = Time.DeltaTime,
            HeroZ               = heroTranslation.Value.z,
            HeroId              = this.heroID,
            KMToTranslationUnit = Settings.KMToTranslationUnit,
            EntityCommandBuffer = entityCommandBufferSystem.CreateCommandBuffer().ToConcurrent(),
        };

        return(movementJob.Schedule(this, inputDeps));
    }
示例#25
0
    protected override void Update()
    {
        moveHandle.Complete();

        if (Input.GetKeyUp(KeyCode.Space))
        {
            SpawnUnits(unitySpawnIncrement);
        }

        jobsMovement.deltaTime = Time.deltaTime;
        jobsMovement.random    = Random.Range(float.MinValue, float.MaxValue);

        moveHandle = jobsMovement.Schedule(transforms);
        JobHandle.ScheduleBatchedJobs();

        UpdateFPS();
    }
示例#26
0
        private static IEnumerator Operate()
        {
            MovementJob _movementJob = new MovementJob();
            EnergyJob   _energyJob   = new EnergyJob();

            while (true)
            {
                if (_Transforms.length == 0)
                {
                    yield return(null);
                }
                int j = 0;

                foreach (Drone drone in Drones.Values)
                {
                    var dE = _EnergyInfoArray[j].energy;
                    drone.UpdateEnergy(dE);
                    drone.GetHub().UpdateEnergy(dE);
                    drone.GetBattery().DischargeBattery(dE);
                    SimManager.UpdateEnergy(dE);

                    _PreviousPositions[j]  = drone.PreviousPosition;
                    drone.PreviousPosition = drone.transform.position;

                    _JobInfoArray[j]    = drone.GetMovementInfo(_JobInfoArray[j]);
                    _EnergyInfoArray[j] = drone.GetEnergyInfo(_EnergyInfoArray[j]);
                    j++;
                }

                _movementJob.nextMove  = _JobInfoArray;
                _movementJob.rt_dt     = _PreviousPositions;
                _movementJob.deltaTime = _time.Timer();

                _energyJob.energies  = _EnergyInfoArray;
                _energyJob.deltaTime = _time.Timer();
                _time.Now();

                movementJobHandle = _movementJob.Schedule(_Transforms);
                energyJobHandle   = _energyJob.Schedule(_Transforms.length, 1);

                yield return(null);

                energyJobHandle.Complete();
                movementJobHandle.Complete();
            }
        }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var lightSourcesCount     = LightSourcesController.Instance.LightSources.Length;
        var lightSourcesPositions = new NativeArray <float3>(lightSourcesCount, Allocator.TempJob);
        var lightSourcesRanges    = new NativeArray <float>(lightSourcesCount, Allocator.TempJob);

        LightSourcesController.Instance.GetLightSourcesPositions(ref lightSourcesPositions);
        LightSourcesController.Instance.GetLightSourcesRanges(ref lightSourcesRanges);

        var job = new MovementJob
        {
            DeltaTime             = Time.deltaTime,
            LightSourcesPositions = lightSourcesPositions,
            LightSourcesRanges    = lightSourcesRanges
        };

        return(job.Schedule(this, inputDeps));
    }
示例#28
0
        protected override JobHandle OnUpdate(JobHandle inputDesc)
        {
            var _translationType = GetArchetypeChunkComponentType <Translation>(false);
            var _rotationType    = GetArchetypeChunkComponentType <Rotation>(false);
            var _moveSpeedType   = GetArchetypeChunkComponentType <MoveSpeedComponent>(true);
            var _moveBounds      = GetArchetypeChunkComponentType <MoveBounds>(true);

            MovementJob job = new MovementJob
            {
                translationType        = _translationType,
                rotationType           = _rotationType,
                moveSpeedComponentType = _moveSpeedType,
                moveBoundsType         = _moveBounds,
                deltaTime = Time.deltaTime
            };

            return(job.Schedule(m_Group, inputDesc));
        }
示例#29
0
        //protected override JobHandle OnUpdate(JobHandle inputDeps)
        //{
        //    MovementJob moveJob = new MovementJob
        //    {
        //        topBound = GameManager.gameManager.topBound,
        //        bottomBound = GameManager.gameManager.bottomBound,
        //        deltaTime = Time.DeltaTime
        //    };
        //    JobHandle moveHandle = moveJob.Schedule(this, inputDeps);
        //    return moveHandle;
        //}


        // OnUpdate runs on the main thread.
        protected override void OnUpdate()
        {
            ComponentTypeHandle <Translation> translationType = GetComponentTypeHandle <Translation>();
            ComponentTypeHandle <Rotation>    rotationType    = GetComponentTypeHandle <Rotation>();
            ComponentTypeHandle <MoveSpeed>   moveSpeedType   = GetComponentTypeHandle <MoveSpeed>(true);

            MovementJob moveJob = new MovementJob()
            {
                TranslationTypeHandle = translationType,
                RotationTypeHandle    = rotationType,
                MoveSpeedTypeHandle   = moveSpeedType,
                deltaTime             = Time.DeltaTime,
                topBound    = GameManager.gameManager.topBound,
                bottomBound = GameManager.gameManager.bottomBound,
            };

            Dependency = moveJob.Schedule(group, Dependency);
        }
示例#30
0
    // Update is called once per frame
    void Update()
    {
        moveJob = new MovementJob()
        {
            maxDistance = this.maxDistance,
            firstPos    = this.firstPos.magnitude,
            step        = this.step,
            time        = Time.deltaTime
        };
        handle = moveJob.Schedule(transforms);
        JobHandle.ScheduleBatchedJobs();

        handle.Complete();

        if (handle.IsCompleted)
        {
            transforms.Dispose();
        }
    }