Пример #1
0
    /// <summary>
    /// Displays the Stimulus on the left or right of a line for a specified duration.
    /// During that duration the player needs to respond as quickly as possible.
    /// </summary>
    protected virtual IEnumerator DisplayStimulus(TippingPointTrial t)
    {
        GameObject stim = stimulus;

        stim.SetActive(false);

        //Left position
        if (t.side == "l")
        {
            stim.GetComponent <RectTransform>().localPosition = leftPosition;
        }
        else         //Right position
        {
            stim.GetComponent <RectTransform>().localPosition = rightPosition;
        }

        yield return(new WaitForSeconds(t.delay));

        StartInput();
        stim.SetActive(true);

        yield return(new WaitForSeconds(t.duration));

        EndInput();

        yield break;
    }
Пример #2
0
    protected bool IsCorrectKey(TippingPointTrial t)
    {
        //Check if proper arrow was hit with proper side
        if (t.side == "l" && keyPressed == KeyCode.LeftArrow)
        {
            return(true);
        }

        if (t.side == "r" && keyPressed == KeyCode.RightArrow)
        {
            return(true);
        }

        return(false);
    }