Skip to content

Instantly share code, notes, and snippets.

@Xevion
Created November 25, 2020 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xevion/9874e661c476eceb43aa02f1f2b5a809 to your computer and use it in GitHub Desktop.
Save Xevion/9874e661c476eceb43aa02f1f2b5a809 to your computer and use it in GitHub Desktop.
/// <summary>
/// Move the ChangeController's current index forward by index.
/// Positive values only, wil only result in forward movement (if any).
/// </summary>
/// <param name="n">The number of times to move forward.</param>
public void Forward(int n = 1) {
if (n < 0)
throw new ArgumentOutOfRangeException(nameof(n));
for (int i = 0; i < n; i++) {
Change cur = _changes[++Index];
Current[cur.X, cur.Y] = cur.New;
SetDirty(new Vector2Int(cur.X, cur.Y));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment