private TouchPointHistoricalEntry getSnapshotAtSecondsAgoFromHistory(float seconds) { var thumbThrough = touchPointHistory.Reverse <TouchPointHistoricalEntry>(); var traversedTime = 0f; TouchPointHistoricalEntry returnSnap = thumbThrough.First(); foreach (TouchPointHistoricalEntry snap in thumbThrough) { returnSnap = snap; traversedTime += snap.TimeDelta; if (traversedTime >= seconds) { break; } } return(returnSnap); }
private void CaptureFrameToHistory() { var thisFrame = new TouchPointHistoricalEntry(Time.deltaTime, Input.mousePosition); touchPointHistory.Enqueue(thisFrame); }