protected Food(BorderWall wall, char foodSymbol, int points) : base(wall.LeftX, wall.TopY) { this.wall = wall; this.FoodPoints = points; this.foodSymbol = foodSymbol; this.random = new Random(); }
public Engine(BorderWall wall, InfoWall infoWall, Snake snake) { this.snake = snake; this.wall = wall; this.infoWall = infoWall; pointsOfDirection = new Point[4]; snakeDirection = defaultSnakeDirection; }
public static void Main() { ConsoleWindow.CustomizeConsole(); BorderWall wall = new BorderWall(GameConstraits.GameCols, GameConstraits.GameRows); InfoWall infoWall = new InfoWall(GameConstraits.InfoCols, GameConstraits.InfoRows); Snake snake = new Snake(wall); Engine engine = new Engine(wall, infoWall, snake); engine.Run(); }
public Snake(BorderWall wall) { this.wall = wall; this.SnakeElements = new Queue <Point>(); this.foods = new Food[3]; this.foodIndex = RandomFoodNumber; this.GetFoods(); this.CreateSnake(); Score = 0; foods[foodIndex].SetRandomPosition(SnakeElements); }
// Helper functions to set tiles in the level to walls private void setWallIntoLevel(BorderWall wallType, int wallIndexX, int wallIndexY) { int tileX = 0, tileY = 0; switch (wallType) { case BorderWall.Single: tileX = wallIndexX * (BORDER_WALL_LENGTH + 1); tileY = wallIndexY * (BORDER_WALL_LENGTH + 1); borderCornerColors[wallIndexX, wallIndexY] = Color.Lerp(Color.White, getTileColor(tileX, tileY), COLOR_TINT_FACTOR); grid[tileX, tileY] = LevelContent.LevelTile.Wall; pathfinding.costGrid[tileX, tileY] = Pathfinding.COST_WALL; break; case BorderWall.Horiz: tileX = wallIndexX * (BORDER_WALL_LENGTH + 1) + 1; tileY = wallIndexY * (BORDER_WALL_LENGTH + 1); borderHorizColors[wallIndexX, wallIndexY] = Color.Lerp(Color.White, getTileColor(tileX, tileY), COLOR_TINT_FACTOR); for (int i = 0; i < BORDER_WALL_LENGTH; i++) { grid[tileX + i, tileY] = LevelContent.LevelTile.Wall; pathfinding.costGrid[tileX + i, tileY] = Pathfinding.COST_WALL; } break; case BorderWall.Vert: tileX = wallIndexX * (BORDER_WALL_LENGTH + 1); tileY = wallIndexY * (BORDER_WALL_LENGTH + 1) + 1; borderVertColors[wallIndexX, wallIndexY] = Color.Lerp(Color.White, getTileColor(tileX, tileY), COLOR_TINT_FACTOR); for (int j = 0; j < BORDER_WALL_LENGTH; j++) { grid[tileX, tileY + j] = LevelContent.LevelTile.Wall; pathfinding.costGrid[tileX, tileY + j] = Pathfinding.COST_WALL; } break; } }
public FoodHash(BorderWall wall) : base(wall, foodSymbol, foodPoints) { }
public FoodDollar(BorderWall wall) : base(wall, foodSymbol, foodPoints) { }
public FoodPercent(BorderWall wall) : base(wall, foodSymbol, foodPoints) { }