public GameManager(ISnake snake, Food food, GameBoardSettings gameBoardSettings, Direction initSnakeDirection, ILogger logger) { if (logger is null) { throw new ArgumentNullException($"Объект {nameof(logger)} не может иметь значение null и должен быть определен"); } if (snake is null) { throw new ArgumentNullException($"Объект {nameof(snake)} не может иметь значение null и должен быть определен"); } if (food is null) { throw new ArgumentNullException($"Объект {nameof(food)} не может иметь значение null и должен быть определен"); } if (gameBoardSettings is null) { throw new ArgumentNullException($"Объект {nameof(gameBoardSettings)} не может иметь значение null и должен быть определен"); } this._snake = snake; this.Snake = snake.Points; this._food = food; this._gameBoardSettings = gameBoardSettings; this._snakeDirectionQueue = new Queue <Direction>(); this._snakeDirectionQueue.Enqueue(initSnakeDirection); this._logger = logger; }
public GameBoardSettings(GameBoardSettings gameBoardSettings) { if (gameBoardSettings is null) { throw new ArgumentNullException($"Значение '{nameof(gameBoardSettings)}' должно быть определено"); } if (gameBoardSettings.GameBoardSize is null) { throw new ArgumentNullException($"Значение '{nameof(gameBoardSettings.GameBoardSize)}' должно быть определено"); } this.TimeUntilNextTurnMilliseconds = gameBoardSettings.TimeUntilNextTurnMilliseconds; this.InitialSnakeLength = gameBoardSettings.InitialSnakeLength; this.GameBoardSize = gameBoardSettings.GameBoardSize; }