public XYInfo(XYInfo origin) { Type = origin.Type; Player = origin.Player; Bomb = origin.Bomb; Bonus = origin.Bonus; Lavas = origin.Lavas; Free = origin.Free; }
public GameBoard() { int size = 15; W = size; H = size; GenerateBoard(size); Bonuses = new List <Bonus>(); Bombs = new List <Bomb>(); Lavas = new List <Lava>(); Players = new List <Player>(); GenerateBonuses(Config.Bonuses_count); for (int i = 0; i < XYinfo.GetLength(0); i++) { for (int j = 0; j < XYinfo.GetLength(1); j++) { XYinfo[i, j] = new XYInfo(); } } }
public GameBoard(int[,] pole) { int size = 15; W = size; H = size; Cells = new Cell[size, size]; Bonuses = new List <Bonus>(); Bombs = new List <Bomb>(); Lavas = new List <Lava>(); Players = new List <Player>(); for (int i = 0; i < XYinfo.GetLength(0); i++) { for (int j = 0; j < XYinfo.GetLength(1); j++) { XYinfo[i, j] = new XYInfo(); } } for (int i = 0; i < Cells.GetLength(0); i++) { for (int j = 0; j < Cells.GetLength(1); j++) { Cells[i, j] = new Cell() { X = i, Y = j, Type = CellType.None }; } } for (int i = 0; i < pole.GetLength(1); i++) { for (int j = pole.GetLength(1) - 1; j >= 0; j--) { switch (pole[j, i]) { case 0: break; case 1: Cells[i, j].Type = CellType.Indestructible; break; case 2: Cells[i, j].Type = CellType.Destructible; break; case 3: Cells[i, j].Type = CellType.Destructible; Bonus bonus = new Bonus(); bonus.X = i; bonus.Y = j; bonus.Type = BonusType.Ammunition; Bonuses.Add(bonus); break; case 4: Cells[i, j].Type = CellType.Destructible; Bonus tbonus = new Bonus(); tbonus.X = i; tbonus.Y = j; tbonus.Type = BonusType.Radius; Bonuses.Add(tbonus); break; case 5: Player player = new Player(); player.X = i; player.Y = j; Players.Add(player); break; case 6: Bonus ttbonus = new Bonus(); ttbonus.X = i; ttbonus.Y = j; ttbonus.Type = BonusType.Ammunition; ttbonus.Visible = true; Bonuses.Add(ttbonus); break; case 7: Bonus tttbonus = new Bonus(); tttbonus.X = i; tttbonus.Y = j; tttbonus.Type = BonusType.Radius; tttbonus.Visible = true; Bonuses.Add(tttbonus); break; default: break; } } } }