private void AddHistory(BoardState state) { if (_currentStateId > 0) { //Console.WriteLine(_currentStateId ); while (History.States.Count > _currentStateId) { History.States.RemoveAt(History.States.Count - 1); } //history = new GameHistory {States = new List<BoardState>(history.States.GetRange(0, _currentStateId))}; _currentStateId = 0; } //history = GameHistory.DeepClone(history); History.States.Add(BoardState.DeepClone(state)); }
public void GoToState(int i) { State = BoardState.DeepClone(History.States[i]); _currentStateId = i + 1; }