Exemplo n.º 1
0
    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;
        }