protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            //Debug.Log("MovementSystem working...");
            float time = Time.DeltaTime;

            NativeQueue <SpeedEvent> .ParallelWriter eventQueueParallel =
                eventsQueue.AsParallelWriter();

            JobHandle jobHandle =
                Entities
                .ForEach((ref Translation translation, ref MovementData movementData) =>
            {
                if (movementData.position.x > 5)
                {
                    movementData.speed.x = -movementData.speed.x;
                    eventQueueParallel.Enqueue(new SpeedEvent {
                    });
                }
                if (movementData.position.x < -5)
                {
                    movementData.speed.x = -movementData.speed.x;
                    eventQueueParallel.Enqueue(new SpeedEvent {
                    });
                }
                if (movementData.position.y > 3)
                {
                    movementData.speed.y = -movementData.speed.y;
                    eventQueueParallel.Enqueue(new SpeedEvent {
                    });
                }
                if (movementData.position.y < -3)
                {
                    movementData.speed.y = -movementData.speed.y;
                    eventQueueParallel.Enqueue(new SpeedEvent {
                    });
                }

                movementData.position =
                    new float3(movementData.position.x + movementData.speed.x * time,
                               movementData.position.y + movementData.speed.y * time, 0);

                translation.Value = movementData.position;
            }).Schedule(inputDeps);

            // работа должна быть завершена, прежде чем мы будем читать события!
            // фактически, мы создаем точку синхронизации
            jobHandle.Complete();

            while (eventsQueue.TryDequeue(out SpeedEvent speedEvent))
            {
                Debug.Log("Event!");
                OnChangeSpeed?.Invoke(this, EventArgs.Empty);
            }

            return(jobHandle);
        }
    public void HandleClick()
    {
        OnChangeSpeed?.Invoke(speed);
        var sisters = UISelectSpeed.sisters;

        for (int i = 0, l = sisters.Count; i < l; i++)
        {
            if (sisters[i] == this)
            {
                continue;
            }
            sisters[i].SetNotActive();
        }
        GetComponent <Image>().sprite = sprites[1];
    }