public Snake(SnakeBuilder builder) { _startPosition = builder.StartPosition; _partSize = builder.PartSize; _startLength = builder.Length; BodyColor = builder.BodyColor; HeadColor = builder.HeadColor; _partsOfsnake = new List <Point>(); }
public Game(Size boardGridSize, Size cellSize) { _boardGridSize = boardGridSize; BackgroundColor = Color.White; Snake = new SnakeBuilder().SetStartPosition(new Point(x: _boardGridSize.Width / 2, y: _boardGridSize.Height / 2)) .SetLength(3) .SetPartSize(cellSize) .SetSnakeBrush(Brushes.LightBlue) .SetSnakeHeadBrush(Brushes.CornflowerBlue) .Build(); Snake.CrashAccident += (sender, e) => CrashAccident?.Invoke(sender, e); Score = new GameScore(); Score.ScoreChanged += (sender, e) => ScoreChanged?.Invoke(sender, e); Ball = new Ball(cellSize); StartNewGame(); }