コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (onRespond == null)
        {
            return;
        }

        TouchUnit touchUnit;

        if (Input.touchCount > 0)
        {
            for (int i = 0; i < Input.touchCount; i++)
            {
                Touch touch = Input.GetTouch(i);
                if (touch.phase == TouchPhase.Began)
                {
                    touchUnit = new TouchUnit(Input.GetTouch(i));
                    if (!onRespond(touchUnit))
                    {
                        touchList.Add(touchUnit);
                    }
                }
                else if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Stationary)
                {
                    touchUnit = findTouchById(touch.fingerId);
                    if (touchUnit != null)
                    {
                        touchUnit.setCurrentTouch(touch);
                        if (onRespond(touchUnit))
                        {
                            touchList.Remove(touchUnit);
                        }
                    }
                }
                else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
                {
                    touchUnit = findTouchById(touch.fingerId);
                    if (touchUnit != null)
                    {
                        touchUnit.setCurrentTouch(touch);
                        onRespond(touchUnit);
                        touchList.Remove(touchUnit);
                    }
                }
            }
        }
        else if (Input.GetMouseButton(0))
        {
            onRespond(null);
        }
    }
コード例 #2
0
ファイル: GameBS.cs プロジェクト: leodd/MusicGameProject
 private bool onRespond(TouchUnit touchUnit)
 {
     test();
     return(false);
 }