// Update is called once per frame void Update() { //wait ten seconds before starting the heart rate measurement waitTime = waitTime + Time.deltaTime; if (waitTime >= 10f && waitFinished == false) { Debug.Log("Ten seconds have passed. Starting the HR Measurement System"); waitFinished = true; } calibrationTime = calibrationTime + Time.deltaTime; if (waitFinished == true && calibrationTime >= 1f && calculated == false) { //Debug.Log ("Ten seconds have passed. Number of Readings: " + numOfReadings + " test Reading: " + testNumber + " Checking array content: " + testNumberCheck + " Average of Readings: " + averageRates()); prevAverage = currAverage; currAverage = averageRates(); Debug.Log("One second has passed. Previous Average of Readings: " + prevAverage + " Current Average of Readings: " + currAverage); //If no recorded averages yet, do not start the checking if (prevAverage > 0f && currAverage > 0f) { playerChanges.setAverages(prevAverage, currAverage); playerChanges.toggleCheck(); envChanges.setAveragesEnv(prevAverage, currAverage); envChanges.toggleEnvCheck(); } calibrationTime = 0f; //Start another average measurement in the next 10 seconds } /**for (int i = 0; i < stackOfRates.Length; i++) { * if (stackOfRates[i] > 0f) { * testNumberCheck++; * } * }**/ // If effect is still going on, do not compare new measurement to new measurement // If changing effect is done, start comparing measurements again // Call on methods from the various Environment Changing Scripts, pass them the previous and new values, and let them do the increments or not. // Have the changes be little increments until they reach their maximum threshold // Environment changes will be permanent. With fog possibly weakening if we want to have it. // Enemy and player (torch light, walk speed(?), camera effects (?) ) changes will vary via the measurement }