コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     for (int i = 0; i < Input.touches.Length; i++)
     {
         if (Input.touches[i].phase == TouchPhase.Began)
         {
             OnTouchBegin?.Invoke(Input.touches[i]);
             CastAtTouch(Input.touches[i]);
         }
     }
 }
コード例 #2
0
    private void BeginTouch(PointerEventData eventData)
    {
        m_pointerID = eventData.pointerId;

        m_lastPoint = eventData.position;
        m_touchDirection.Set(0, 0);
        m_delta.Set(0, 0);

        CalculateTouchDirection(eventData.position, eventData.pressEventCamera);

        onTouchBegin?.Invoke(m_touchDirection);
    }
コード例 #3
0
 public virtual void  TouchBegin(Vector2 _touchScreenLocation)
 {
     touchWorldPoint                 = cameraRef.ScreenToWorldPoint(_touchScreenLocation);
     touchScreenCoordinate           = _touchScreenLocation;
     startTouchLocation              = endTouchLocation = _touchScreenLocation;
     _axisValue.x                    = 0;
     _axisValue.y                    = 0;
     touchInfo.touchWorldPoint       = touchWorldPoint;
     touchInfo.touchScreenCoordinate = touchScreenCoordinate;
     touchInfo.endTouchLocation      = endTouchLocation;
     touchInfo.deltaRelease          = deltaRelease;
     touchInfo.touchScreenRatio      = touchScreenRatio;
     OnTouchBegin?.Invoke(touchInfo);
 }
コード例 #4
0
ファイル: UITouchPad.cs プロジェクト: NoeCalmness/CoreFrame
    private void BeginTouch(PointerEventData eventData)
    {
        m_pointerID = eventData.pointerId;

        m_startTouchTime = Time.time;
        m_dist           = 0;
        m_moved          = false;
        m_resetMoveState = false;

        m_lastPoint  = eventData.position;
        m_startPoint = m_lastPoint;

        CalculateTouchDirection(m_lastPoint);

        onTouchBegin?.Invoke(m_startPoint);
    }
コード例 #5
0
    void OnTapDown(int fingerId, Vector3 tapPosition)
    {
        myRay = mainCamera.ScreenPointToRay(tapPosition);

        if (Physics.Raycast(myRay, out hitInfo, raycastLength, uiLayer, QueryTriggerInteraction.Collide))
        {
            uiScreenPressed = true;
            OnUITouchBegin?.Invoke(fingerId, tapPosition, hitInfo);
        }
        else
        {
            myRay = mainCamera.ScreenPointToRay(tapPosition);
            if (Physics.Raycast(myRay, out hitInfo, raycastLength,
                                Camera.main.cullingMask, QueryTriggerInteraction.Collide))
            {
                OnTouchBegin?.Invoke(fingerId, tapPosition, hitInfo);
            }
            else
            {
                OnTouchBegin?.Invoke(fingerId, tapPosition, new RaycastHit());
            }
        }
    }
コード例 #6
0
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            OnTouchBegin?.Invoke();
        }