Esempio n. 1
0
        public JobHandle Execute(JobHandle _jobHandle)
        {
            if (_done == true)
            {
                return(_jobHandle);
            }

            var spawnRed = new SpawningJob()
            {
                _group     = GameGroups.RED_DOOFUSES_NOT_EATING.BuildGroup
                , _factory = _factory
                , _entity  = _redCapsule
                , _random  = new Random(1234567)
            }.ScheduleParallel(MaxNumberOfDoofuses, _jobHandle);

            var spawnBlue = new SpawningJob()
            {
                _group     = GameGroups.BLUE_DOOFUSES_NOT_EATING.BuildGroup
                , _factory = _factory
                , _entity  = _blueCapsule
                , _random  = new Random(7654321)
            }.ScheduleParallel(MaxNumberOfDoofuses, _jobHandle);

            //Yeah this shouldn't be solved like this, but I keep it in this way for simplicity sake
            _done = true;

            return(JobHandle.CombineDependencies(spawnBlue, spawnRed));
        }
Esempio n. 2
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var jobHandle = new SpawningJob()
        {
            ecb          = ecbs.CreateCommandBuffer().ToConcurrent(),
            positionY    = 5,
            materialType = randomGenerator.NextInt(3),
            deltaTime    = Time.DeltaTime
        }.Schedule(this, inputDeps);

        ecbs.AddJobHandleForProducer(jobHandle);

        return(jobHandle);
    }