private void Update() { if (!isInit) { return; } long preSpinCount = spinCount; if (isMoving) { moveValue += speed * 0.1f; } while (moveValue >= 1f) { moveValue -= 1f; CursorUp(); } while (moveValue <= -1f) { moveValue += 1f; CursorDown(); } if (preSpinCount != spinCount) //커서가 변경되었을 때 //다음 커서값 설정하기 { if (cursorRequest != null) { if (dir == RotateDirection.Down) { cursors[cursors.Count - 1] = cursorRequest.settingCursor - cursorRequest.waitCount; } else { cursors[0] = cursorRequest.settingCursor + cursorRequest.waitCount; } cursorRequest.waitCount -= 1; cursorRequest = null; } if (stopRequest > 0) { stopRequest--; } if (stopRequest == 0) { moveValue = 0f; ApplyMoveValue(); state = ReelState.Idle; OnStoped?.Invoke(); } UpdateRenderAll(); OnCursorChanged?.Invoke(cursor); } }
public void SetCursorRequest(int waitCount, int setCursor) { cursorRequest = new CursorRequest(waitCount, setCursor); }