コード例 #1
0
    public override void Update()
    {
        ExitTestButton.AddValuesToTrack(yesCount, noCount);
        if (Input.touchCount > 0)
        {
            Touch touch = Input.touches[0];
            recordedPositions.Add(touch.deltaPosition);
        }
        else
        {
            recordedPositions.Add(new Vector2(Input.mousePosition.x, Input.mousePosition.y) -
                                  new Vector2(lastMousePos.x, lastMousePos.y));
            lastMousePos = Input.mousePosition;
        }

        if (timer >= delay)
        {
            timer = 0f;
            WaitForNextSample();
        }
        else
        {
            timer += Time.deltaTime;
        }

        base.Update();

        VerifyCompletion();
    }
コード例 #2
0
    public override void Update()
    {
        ExitTestButton.AddValuesToTrack((int)currentValue, (int)targetValue);

        if (Input.touchCount > 0)
        {
            switch (Input.GetTouch(0).phase)
            {
            case TouchPhase.Began:
                currentValue += Input.GetTouch(0).deltaPosition.x *valueAdjustment;
                break;

            case TouchPhase.Moved:
                currentValue += Input.GetTouch(0).deltaPosition.x *valueAdjustment;
                break;
            }
        }
        else
        {
            if (Input.GetMouseButton(0))
            {
                currentValue     += Input.mousePosition.x - lastMousePosition.x;
                lastMousePosition = Input.mousePosition;
            }
            else
            {
                lastMousePosition = Input.mousePosition;
            }
        }

        base.Update();
        VerifyCompletion();
    }