コード例 #1
0
        protected override void OnUpdate()
        {
            _input = World.GetExistingSystem <InputSystem>();

            switch (Process)
            {
            case true:
            {
                PositionCurrent = CameraUtil.ScreenPointToWorldPoint(World, InputUtil.GetInputPosition(_input));
                if (InputUtil.GetInputUp(_input))
                {
                    PositionUp = PositionCurrent;
                    Process    = false;
                    OnEndProses();
                }

                break;
            }

            case false when InputUtil.GetInputDown(_input):
                PositionDown = CameraUtil.ScreenPointToWorldPoint(World, InputUtil.GetInputPosition(_input));

                Process = true;
                OnStartProses();
                break;
            }
        }
コード例 #2
0
        protected override void OnUpdate()
        {
            _input = World.GetExistingSystem <InputSystem>();
            var physicsWorld = World.GetExistingSystem <PhysicsWorldSystem>().PhysicsWorld;

            if (InputUtil.GetInputUp(_input))
            {
                float2 pos    = CameraUtil.ScreenPointToWorldPoint(World, InputUtil.GetInputPosition(_input));
                Entity entity = DrawBordersSystem.GetInputEntity(physicsWorld, pos);
                if (entity == Entity.Null)
                {
                    return;
                }
                ButtonsType buttonsType = EntityManager.GetComponentData <ButtonsComponent>(entity).ButtonsType;
                Button(buttonsType);
            }
        }
コード例 #3
0
ファイル: InputSystem.cs プロジェクト: krvs/match3
    public override void OnUpdate(float deltaTime)
    {
        if (InputUtil.GetInputDown())
        {
            _startPosition = Camera.main.ScreenToWorldPoint(new Vector3(InputUtil.GetInputPosition().x, InputUtil.GetInputPosition().y, 7));
        }
        else if (InputUtil.GetInputUp())
        {
            var inputPos   = Camera.main.ScreenToWorldPoint(new Vector3(InputUtil.GetInputPosition().x, InputUtil.GetInputPosition().y, 7));
            var inputDelta = inputPos - _startPosition;

            var     inputData          = _inputFilter.Select <InputData>();
            ref var inputDataComponent = ref inputData.GetComponent(0);

            //Нужна ли тут физика?
            inputDataComponent.Entity     = GetCellFromInput(_startPosition);
            inputDataComponent.DeltaInput = inputDelta;
        }