//Method that checks que if if there is a longer pause than 5 sec between two compressions private bool checkForLongPauses() { int queCount = compressionQueue.Count; if (queCount > 3) { for (int i = 0; i < queCount - 2; i++) { if (compressionQueue.Peek(i) - compressionQueue.Peek(i + 1) > TooLongPause) { return(true); } } } return(false); }
//Attempts to calculate the rate the user is pressing the ventilator per minute private void calculateVentilationRate() { int queueCount = DepressionsQueue.Count; if (queueCount >= 3) { float sum = 0; for (int i = 0; i < queueCount - 1; i++) { sum += DepressionsQueue.Peek(i) - DepressionsQueue.Peek(i + 1); } VentilationRate = 60 / (sum / (queueCount - 1)); Debug.Log("Vent rate: " + VentilationRate); } }