public void Execute(int column, int row) { if (_gameBoard.GetMovableAt(column, row) is Train train) { _gameState.SetCurrentTrain(train); } }
public void Execute(int column, int row) { if (_gameBoard.GetMovableAt(column, row) is Train train) { _gameState.SetCurrentTrain(train); } else { _trackLayout.ToggleTrack(column, row); } }
public void Execute(int column, int row) { if (_gameBoard.GetMovableAt(column, row) is Train train) { _gameState.SetCurrentTrain(train); } else { if (_trackLayout.TryGet(column, row, out Track? track)) { track.TryToggle(); } } }
public void Execute(int column, int row, bool isPartOfDrag) { if (isPartOfDrag) { return; } if (_gameBoard.GetMovableAt(column, row) is Train train) { _trainManager.CurrentTrain = train; } else { if (_trackLayout.TryGet(column, row, out Track? track)) { track.NextState(); } } }
public void Execute(int column, int row, bool isPartOfDrag) { _collection.Remove(column, row); if (_gameBoard.GetMovableAt(column, row) is { } moveable) { _gameBoard.RemoveMovable(moveable); if (_trainManager.CurrentTrain == moveable) { _trainManager.CurrentTrain = null; } } }
public bool IsValid(int column, int row) => _trackLayout.TryGet(column, row, out _) && _gameBoard.GetMovableAt(column, row) == null;
public bool IsValid(int column, int row) => _gameBoard.GetTrackAt(column, row) != null && _gameBoard.GetMovableAt(column, row) == null;