Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown("r") && sm.canRandomize)
        {
            delayTime = sm.delayTime;
            cdr       = sm.cdr;
            RandomizeCursorPos();
        }

        float   ax        = Input.GetAxis("Mouse X");
        float   ay        = Input.GetAxis("Mouse Y");
        Vector3 direction = new Vector3(ax, ay, 0) * 0.5f;

        if (!sm.isDelay)
        {
            StartCoroutine(UserCursorFunc.DelayCursor(delayTime, () =>
            {
                UserCursorFunc.MoveCursor(gameObject, direction, cdr);
            }));
        }
        else
        {
            UserCursorFunc.MoveCursor(gameObject, direction, cdr);
        }
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        if (sm.isStartSession)
        {
            ax = Input.GetAxis("Mouse X");
            ay = Input.GetAxis("Mouse Y");
            Vector3 direction = new Vector3(ax, ay, 0) * 0.5f;

            if (sm.isDelay)
            {
                StartCoroutine(UserCursorFunc.DelayCursor(sm.delayTime, () =>
                {
                    UserCursorFunc.MoveCursor(gameObject, direction, sm.cdr);
                }));
            }
            else
            {
                UserCursorFunc.MoveCursor(gameObject, direction, sm.cdr);
            }

            sm.absPosStock.Add(new Vector2(gameObject.transform.position.x, gameObject.transform.position.y));
            sm.relPosStock.Add(new Vector2(gameObject.transform.position.x - px, gameObject.transform.position.y - py));
            px = gameObject.transform.position.x;
            py = gameObject.transform.position.y;


            if (gameObject.transform.position.y >= 4.6f && sm.isStartStudy)
            {
                FinishSession();
            }
        }
    }