示例#1
0
    /// <summary>
    /// Returns the players response accuracy.
    /// The perfect accuracy would be 1, most inaccuracy is 0.
    /// </summary>
    protected float GetAccuracy(Trial t, float time)
    {
        ReactData data = sessionData.gameData as ReactData;
        bool      hasResponseTimeLimit = data.ResponseTimeLimit > 0;

        float rTime           = time - data.GuessTimeLimit;
        float totalTimeWindow = hasResponseTimeLimit ?
                                data.ResponseTimeLimit : (t as ReactTrial).duration;

        return(1f - (rTime / (totalTimeWindow - data.GuessTimeLimit)));
    }
示例#2
0
    /// <summary>
    /// Parses Game specific variables for this Trial from the given XmlElement.
    /// If no parsable attributes are found, or fail, then it will generate some from the given GameData.
    /// Used when parsing a Trial that IS defined in the Session file.
    /// </summary>
    public override void ParseGameSpecificVars(XmlNode n, SessionData session)
    {
        base.ParseGameSpecificVars(n, session);

        ReactData data = (ReactData)(session.gameData);

        if (!XMLUtil.ParseAttribute(n, ReactData.ATTRIBUTE_DURATION, ref duration, true))
        {
            duration = data.GeneratedDuration;
        }
    }
示例#3
0
    /// <summary>
    /// Returns True if the given response time is considered valid.
    /// </summary>
    protected bool IsValidResponse(float time)
    {
        ReactData data = sessionData.gameData as ReactData;

        return(data.ResponseTimeLimit <= 0 || time < data.ResponseTimeLimit);
    }
示例#4
0
    /// <summary>
    /// Returns True if the given response time is considered a guess.
    /// </summary>
    protected bool IsGuessResponse(float time)
    {
        ReactData data = sessionData.gameData as ReactData;

        return(data.GuessTimeLimit > 0 && time < data.GuessTimeLimit);
    }