public IEnumerator MoveSpaces(int spaces) { bool movingForward = spaces > 0; spaces = Math.Abs(spaces); for (int i = 0; i < spaces; i++) { BoardLocation targetSpace = movingForward ? currentSpace.next : currentSpace.preceding; currentSpace.PassBy(this); float timeForJump = .9f * (Mathf.Sqrt((i * 1.0f) / spaces + .8f) - .35f); yield return(JumpToSpace(targetSpace, timeForJump)); // Rotate if we're on a corner space. if (currentSpace is PassGo || currentSpace is GoToJail || currentSpace is InJail || currentSpace is FreeParking) { yield return(RotateAdditionalDegrees(movingForward ? 90 : -90, 1f)); } } // Tell the space we ended on that we landed on it. yield return(currentSpace.LandOn(this)); }