// Start is called before the first frame update void Start() { // Get the name of the current active scene currentSceneName = SceneManager.GetActiveScene().name; // Call the function to calculate the overall cognitive or motor level overallScoreSeq = AbilityManagement.GetOverallScoreSeq(); // Link TextMeshProUGUI field to UI Component scoreValue = GameObject.Find("ScoreValue").GetComponent <TMPro.TextMeshProUGUI>(); levelValue = GameObject.Find("LevelValue").GetComponent <TMPro.TextMeshProUGUI>(); // Fill in score and level in UI UpdateScoreAndLevelText(); }
/// <summary> /// The Update function /// calls the functions to get the calculated scores to be displayed on /// the screen. /// </summary> private void Update() { // If the Ability.Measure() function is called in BatterySessionManagement // and the Text is not filled yet if (!isFilled && BatterySessionManagement.IfMeasureCalled()) { // Call the function to calculate and update subscore values subScoreSeq = AbilityManagement.GetSubScoreSeq(); // Call the function to calculate the overall cognitive or motor level overallScoreSeq = AbilityManagement.GetOverallScoreSeq(); // Update the text shown on the screen to show the cognitive and motor levels GetScoreAndLevel(); // Toggle the boolean to indicate that the text values for the levels have been filled isFilled = true; } }
public IEnumerator WHEN_GetOverallScoreSeqFunctionCalled_THEN_OverallScoreSeqReturned() { // Create example OverallScoreStorage object: OverallScoreStorage overall_inhibition = new OverallScoreStorage { AbilityName = AbilityName.INHIBITION, Score = 100, Level = AbilityLevel.EXCELLENT }; AbilityManagement.overallScoreSeq.Add(overall_inhibition); // Call tested function List <OverallScoreStorage> gottenOverallScoreSeq = AbilityManagement.GetOverallScoreSeq(); yield return(null); Assert.AreEqual(AbilityManagement.overallScoreSeq, gottenOverallScoreSeq); }
// Helper Function /// <summary> /// Iterate through overallScoreSeq and fill the expected score variables /// with the correct score and level values. /// </summary> private void GetScoreAndLevel() { // Get the expected score values overallScoreSeq = AbilityManagement.GetOverallScoreSeq(); foreach (OverallScoreStorage overallScore in overallScoreSeq) { if (overallScore.AbilityName == AbilityName.POINTING) { expectedPointingScore = overallScore.Score.ToString(); expectedPointingLevel = overallScore.Level.ToString(); } if (overallScore.AbilityName == AbilityName.INHIBITION) { expectedInhibitionScore = overallScore.Score.ToString(); expectedInhibitionLevel = overallScore.Level.ToString(); } if (overallScore.AbilityName == AbilityName.SELECTIVE_VISUAL) { expectedSelectiveVisualScore = overallScore.Score.ToString(); expectedSelectiveVisualLevel = overallScore.Level.ToString(); } if (overallScore.AbilityName == AbilityName.VISUOSPATIAL_SKETCHPAD) { expectedVisuospatialSketchpadScore = overallScore.Score.ToString(); expectedVisuospatialSketchpadLevel = overallScore.Level.ToString(); } if (overallScore.AbilityName == AbilityName.TIME_TO_CONTACT) { expectedTimeToContactScore = overallScore.Score.ToString(); expectedTimeToContactLevel = overallScore.Level.ToString(); } if (overallScore.AbilityName == AbilityName.OBJECT_RECOGNITION) { expectedObjectRecognitionScore = overallScore.Score.ToString(); expectedObjectRecognitionLevel = overallScore.Level.ToString(); } } }