/// <summary> /// Returns the players response accuracy. /// The perfect accuracy would be 1, most inaccuracy is 0. /// </summary> protected float GetAccuracy(Trial t, float time) { TippingPointData data = sessionData.gameData as TippingPointData; bool hasResponseTimeLimit = data.ResponseTimeLimit > 0; float rTime = time - data.GuessTimeLimit; float totalTimeWindow = hasResponseTimeLimit ? data.ResponseTimeLimit : (t as TippingPointTrial).duration; return(1f - (rTime / (totalTimeWindow - data.GuessTimeLimit))); }
/// <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); TippingPointData data = (TippingPointData)(session.gameData); if (!XMLUtil.ParseAttribute(n, TippingPointData.ATTRIBUTE_DURATION, ref duration, true)) { duration = data.GeneratedDuration; } XMLUtil.ParseAttribute(n, TippingPointData.ATTRIBUTE_SIDE, ref side); }
/// <summary> /// Returns True if the given response time is considered valid. /// </summary> protected bool IsValidResponse(float time) { TippingPointData data = sessionData.gameData as TippingPointData; return(data.ResponseTimeLimit <= 0 || time < data.ResponseTimeLimit); }
/// <summary> /// Returns True if the given response time is considered a guess. /// </summary> protected bool IsGuessResponse(float time) { TippingPointData data = sessionData.gameData as TippingPointData; return(data.GuessTimeLimit > 0 && time < data.GuessTimeLimit); }