public int ProgressToTicks(double progress) { if (tempoDurations.Count <= 1) { return((int)((double)sequence.GetLength() * progress)); } else { double passed = 0; double passedNext = 0; foreach (TempoDuration tempoDuration in tempoDurations) { passedNext += ((double)tempoDuration.Tempo * (double)tempoDuration.Length / (double)rawDuration); if (progress <= passedNext) { double ratio = (progress - passed) / ((double)tempoDuration.Tempo * (double)tempoDuration.Length / (double)rawDuration); return(tempoDuration.Start + (int)(Math.Round(tempoDuration.Length * ratio))); } passed = passedNext; } } return(-1); }
void Update() { Timer.text = sequence.GetLength().ToString(); }