Esempio n. 1
0
        private void Update()
        {
            // Update the delta always, this helps working around initialization issues :D
            UpdateDelta();

            if (!isActive)
            {
                return;
            }

            if (!hadInputDownAfterGameStart)
            {
                delta = 0f;
            }

            // This also works on touch devices
            if (Input.GetMouseButtonDown(0))
            {
                hadInputDownAfterGameStart = true;
                PointerDownEvent?.Invoke();
            }

            // This also works on touch devices
            if (Input.GetMouseButtonUp(0) && hadInputDownAfterGameStart)
            {
                PointerUpEvent?.Invoke();
            }

            // This also works on touch devices
            if (!Input.GetMouseButton(0))
            {
                return;
            }

            HorizontalDragEvent?.Invoke(delta);
        }
Esempio n. 2
0
 public override void OnPointerDown(PointerEventData ped)
 {
     OnPressEvent.Invoke();
 }