/// <summary> /// 直接生成地图不注册区域 /// </summary> /// <param name="mapType"></param> /// <returns></returns> private ChessboardCell[,] MakeMap(MapType mapType = MapType.Common) { var idList = new IDList(""); var temp = new ChessboardCell[8, 12]; for (int x = 0; x < temp.GetLength(0); x++)//初始化区块 { for (int y = 0; y < temp.GetLength(1); y++) { Position a = new Position(x, y); temp[x, y] = new ChessboardCell(idList, a); } } for (int x = 0; x < temp.GetLength(0); x++)//设定召唤区块 { for (int y = 0; y < 2; y++) { temp[x, y].CellType = ChessboardCellType.Birth; temp[x, y].Owner = GameCore.Teams[0]; } for (int y = temp.GetLength(1) - 2; y < temp.GetLength(1); y++) { temp[x, y].CellType = ChessboardCellType.Birth; temp[x, y].Owner = GameCore.Teams[1]; } } if (temp.GetLength(0) % 2 == 0) //设定基地,自动基地判断大小 { for (int x = temp.GetLength(0) / 2 - 1; x <= temp.GetLength(0) / 2; x++) //偶数 { for (int y = 0; y <= 0; y++) { temp[x, y].CellType = ChessboardCellType.Base; } for (int y = temp.GetLength(1) - 1; y <= temp.GetLength(1) - 1; y++) { temp[x, y].CellType = ChessboardCellType.Base; } } } else { for (int x = temp.GetLength(0) / 2 - 1; x <= temp.GetLength(0) / 2 + 1; x++) //奇数 { for (int y = 0; y <= 0; y++) { temp[x, y].CellType = ChessboardCellType.Base; } for (int y = temp.GetLength(1) - 1; y <= temp.GetLength(1) - 1; y++) { temp[x, y].CellType = ChessboardCellType.Base; } } } return temp; }
/// <summary> /// 第一参数为ID提供者,第二参数为坐标 /// </summary> /// <param name="idList"></param> /// <param name="location"></param> public ChessboardCell(IDList idList, Position location) { idList.ApplyID(this); Location = location; CellType = ChessboardCellType.Common; }