コード例 #1
0
ファイル: PlayerInput.cs プロジェクト: Nevey/VoodooTest
        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);
        }
コード例 #2
0
 public override void OnPointerDown(PointerEventData ped)
 {
     OnPressEvent.Invoke();
 }