Exemplo n.º 1
0
    protected override void OnUpdate()
    {
        _query.SetChangedVersionFilter(typeof(MoveStats));

        MoveJob _moveJob = new MoveJob();

        _moveJob._deltaTime         = Time.DeltaTime;
        _moveJob._moveStatsHandle   = GetComponentTypeHandle <MoveStats>(false);
        _moveJob._translationHandle = GetComponentTypeHandle <Translation>(false);
        _moveJob._entityTypeHandle  = GetEntityTypeHandle();
        _moveJob._ecb = m_EndSimulationEcbSystem.CreateCommandBuffer().AsParallelWriter();
        _moveJob.ScheduleParallel(_query, Dependency);

        m_EndSimulationEcbSystem.AddJobHandleForProducer(this.Dependency);
    }
Exemplo n.º 2
0
    protected override void OnUpdate()
    {
        var updateTranslationJob = new MoveJob();

        updateTranslationJob.moveDataTypeHandle = this.
                                                  GetComponentTypeHandle <MoveData>(false);
        updateTranslationJob.translationTypeHandle = this.
                                                     GetComponentTypeHandle <Translation>(false);

        updateTranslationJob.DeltaTime = World.Time.DeltaTime;


        this.Dependency = updateTranslationJob.
                          ScheduleParallel(query, 1, this.Dependency);
    }
    protected override void OnUpdate()
    {
        //_ecb = m_EndSimulationEcbSystem.CreateCommandBuffer().AsParallelWriter();
        var _ecb = m_EntityCommandBufferSystem.CreateCommandBuffer().AsParallelWriter();

        //this.GetEntityQuery(typeof(HerosArchetype), ComponentType.ReadOnly<MoveStats>(), ComponentType.ReadOnly<SouffleDeFeuTemp>(), ComponentType.ReadWrite<AbilityStats>());

        if (_queryInput.CalculateEntityCount() > 0)
        {
            var pouettt = _queryInput.GetSingletonEntity();
            if (Input_Mouse_0_Up && (Input_Mouse_0_Up != EntityManager.HasComponent <Input_Mouse_0_Up>(pouettt)))
            {
                Input_Mouse_0_GetDown = true;
                Input_Mouse_0_Up      = false;
            }
            if (!Input_Mouse_0_Up && (!Input_Mouse_0_Up != EntityManager.HasComponent <Input_Mouse_0_Up>(pouettt)))
            {
                Input_Mouse_0_GetUp = true;
                Input_Mouse_0_Up    = true;
            }
        }

        if (Input.GetKey(KeyCode.Z) == true)
        {
            Debug.Log("InputZZ!!");
            MoveJob _moveJob = new MoveJob();
            _moveJob._moveStatsHandle = GetComponentTypeHandle <MoveStats>(false);
            _moveJob._dt        = Time.DeltaTime;
            _moveJob._direction = new float3(1, 0, 0);
            this.Dependency     = _moveJob.ScheduleParallel(_heroesQuery, this.Dependency);
        }
        if (Input.GetKey(KeyCode.Q) == true)
        {
            Debug.Log("InputZZ!!");
            MoveJob _moveJob = new MoveJob();
            _moveJob._moveStatsHandle = GetComponentTypeHandle <MoveStats>(false);
            _moveJob._dt        = Time.DeltaTime;
            _moveJob._direction = new float3(1, 0, 0);
            this.Dependency     = _moveJob.ScheduleParallel(_heroesQuery, this.Dependency);
        }
        if (Input.GetKey(KeyCode.S) == true)
        {
            Debug.Log("InputZZ!!");
            MoveJob _moveJob = new MoveJob();
            _moveJob._moveStatsHandle = GetComponentTypeHandle <MoveStats>(false);
            _moveJob._dt        = Time.DeltaTime;
            _moveJob._direction = new float3(1, 0, 0);
            this.Dependency     = _moveJob.ScheduleParallel(_heroesQuery, this.Dependency);
        }
        if (Input.GetKey(KeyCode.D) == true)
        {
            Debug.Log("InputZZ!!");
            MoveJob _moveJob = new MoveJob();
            _moveJob._moveStatsHandle = GetComponentTypeHandle <MoveStats>(false);
            _moveJob._dt        = Time.DeltaTime;
            _moveJob._direction = new float3(1, 0, 0);
            this.Dependency     = _moveJob.ScheduleParallel(_heroesQuery, this.Dependency);
        }


        if (Input.GetKey(KeyCode.A) == true)
        {
            Debug.Log("pouetAAAAAAAAAAA");
            Debug.Log(_query.CalculateEntityCount() + "_souffleQuery");
            AbilityOneJob _abilityOneJob = new AbilityOneJob();
            _abilityOneJob._souffleHandle  = GetComponentTypeHandle <SouffleDeFeuStats>(true);
            _abilityOneJob._abilityPerform = GetComponentTypeHandle <AbilityPerform>(true);
            _abilityOneJob._souffleDeFeu   = _souffleDeFeu;
            _abilityOneJob._ecb            = _ecb;
            _abilityOneJob._entityHandle   = GetEntityTypeHandle();
            this.Dependency = _abilityOneJob.ScheduleParallel(_heroesQuery, this.Dependency);


            Dependency.Complete();
        }
        m_EntityCommandBufferSystem.AddJobHandleForProducer(Dependency);



        m_EntityCommandBufferSystem.AddJobHandleForProducer(this.Dependency);

        this.Dependency.Complete();
    }