private IEnumerator ResetAllRotations() { foreach (ControlRotation controlRotation in allControllers) { if (!controlRotation.HasMoved) { continue; } controlRotation.ResetRotation(); ControlRotation rotation = controlRotation; yield return(new WaitUntil(() => !controlRotation.HasMoved)); } }
private IEnumerator MoveSequence() { sequenceIsBeingExecuted = true; yield return(ResetAllRotations()); for (int index = 0; index < maxIndex; index++) { ControlRotation controlRotation = roboticParts[index]; if (controlRotation == null) { continue; } controlRotation.RotateAroundAxis(angles[index], speed); yield return(new WaitUntil(() => !controlRotation.IsMoving)); } onSequenceEnded.Invoke(); yield return(ResetAllRotations()); sequenceIsBeingExecuted = false; }