public SnakeGame(IReadOnlyList <ISnakeController> controllers) { Controllers = controllers; graphics = new GraphicsDeviceManager(this); scorePosition = new Vector2(ScreenWidth / 2f, 50); rand = new Random(); gridDescription = new GridDescription(GridSize, RowCount, ColumnCount); Content.RootDirectory = "Content"; Window.Title = "Snake"; }
internal GameInstance(GridDescription gridDescription, Snake snake, ISnakeController controller, RandomFoodGenerator randomFoodGenerator) { this.gridDescription = gridDescription; this.snake = snake; this.controller = controller; this.randomFoodGenerator = randomFoodGenerator; foodPosition = GenerateFoodPosition(); elapsedTimeSinceMove = 0; speed = 10; IsSnakeAlive = true; Score = 0; }
public RandomFoodGenerator(GridDescription gridDescription, Random randomGenerator) { this.gridDescription = gridDescription; this.randomGenerator = randomGenerator; squaresCount = gridDescription.RowCount * gridDescription.ColumnCount; }