Skip to content

Instantly share code, notes, and snippets.

@Tsumio
Last active November 12, 2017 10:48
Show Gist options
  • Save Tsumio/0d1cdb7f8010de9219f6106a1baf834b to your computer and use it in GitHub Desktop.
Save Tsumio/0d1cdb7f8010de9219f6106a1baf834b to your computer and use it in GitHub Desktop.
C#Sample
private void MoveDownCursor() {
//this.CurrentNum = (this.CurrentNum + 1) % this.MaxMenuNum; -> これが直に計算した場合の方法
this.CurrentNum = (int)Mathf.Repeat(++this.CurrentNum, this.MaxMenuNum);
}
private void MoveUpCursor() {
//this.CurrentNum = (this.CurrentNum + (MaxMenuNum-1)) % this.MaxMenuNum; -> これが直に計算した場合の方法
this.CurrentNum = (int)Mathf.Repeat(--this.CurrentNum, this.MaxMenuNum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment