经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 程序设计 » C++ » 查看文章
地下城地图图块生成算法
来源:cnblogs  作者:张宏港  时间:2022/12/12 9:13:12  对本文有异议

一. 概述

生成地下城,包含房间和迷宫通路。类似:

  1. 示例效果一
    image
  2. 示例效果二
    image

二. 思路

1.生成迷宫通路

image

  • 从房间的边缘坐标XY为奇数的格子生成迷宫,确保房间和迷宫通路之间有间隔墙壁(除了蓝色格子视为墙壁)。
  • 迷宫通路生长每次探测两个格子,确保迷宫通路间有间隔墙壁。

2.生成过程

image

三. 代码示例

位置结构体

  1. public struct Vec2
  2. {
  3. public int x;
  4. public int y;
  5. public Vec2(int x, int y)
  6. {
  7. this.x = x;
  8. this.y = y;
  9. }
  10. public static Vec2 Zero
  11. {
  12. get
  13. {
  14. return new Vec2(0, 0);
  15. }
  16. }
  17. public override bool Equals(object obj)
  18. {
  19. if (!(obj is Vec2))
  20. return false;
  21. var o = (Vec2)obj;
  22. return x == o.x && y == o.y;
  23. }
  24. public override int GetHashCode()
  25. {
  26. return x.GetHashCode() + y.GetHashCode();
  27. }
  28. public static Vec2 operator+ (Vec2 a, Vec2 b)
  29. {
  30. return new Vec2(a.x + b.x, a.y + b.y);
  31. }
  32. public static Vec2 operator* (Vec2 a, int n)
  33. {
  34. return new Vec2(a.x * n, a.y * n);
  35. }
  36. public static Vec2 operator* (int n, Vec2 a)
  37. {
  38. return new Vec2(a.x * n, a.y * n);
  39. }
  40. public static bool operator== (Vec2 a, Vec2 b)
  41. {
  42. return a.x == b.x && a.y == b.y;
  43. }
  44. public static bool operator !=(Vec2 a, Vec2 b)
  45. {
  46. return !(a.x == b.x && a.y == b.y);
  47. }
  48. }

房间,区域的定义

  1. public struct Region
  2. {
  3. public int id;
  4. public List<Vec2> positions;
  5. public Region(int id)
  6. {
  7. this.id = id;
  8. positions = new List<Vec2>();
  9. }
  10. }
  11. struct Room
  12. {
  13. public Rect rect;
  14. public List<Vec2> borders;
  15. public Room(int x, int y, int w, int h)
  16. {
  17. rect = new Rect(x, y, w, h);
  18. borders = new List<Vec2>();
  19. for (int i = x; i <= x + w; i++)
  20. for (int j = y; j <= y + h; j++)
  21. if (!(i > x && x < x + w && j > y && j < y + h))
  22. borders.Add(new Vec2(i, j));
  23. }
  24. }
  • Room中的格子,计算生成迷宫和尝试连接区域,只需要计算房间边缘的格子即borders。

生成算法上下文

  1. struct Context
  2. {
  3. public Vec2 size;
  4. public int roomCnt;
  5. public int windingPct;
  6. public int roomSizeOff;
  7. public int[,] map;
  8. public List<Region> regions;
  9. public List<Room> rooms;
  10. public int regionIDIdx;
  11. }
  • size 地图的大小,由输入地图大小裁剪成长宽为奇数的大小。
  • roomCnt 预期生成地图的数量。
  • windingPct 地图的蜿蜒程度最大为100 注意:即使为0,地图的蜿蜒程度一般也会比较大。
  • roomSizeOff 房间长或宽的数值正负偏移
  • map 记录地图土块的类型索引
  • regions 地区列表
  • room 房间列表
  • 地区ID索引计数

生长方向枚举

  1. public enum EDir
  2. {
  3. Up = 0,
  4. Down = 1,
  5. Left = 2,
  6. Right = 3,
  7. }
  8. static Dictionary<EDir, Vec2> dirDict = new Dictionary<EDir, Vec2>
  9. {
  10. {EDir.Up, new Vec2(0, 1) },
  11. {EDir.Down, new Vec2(0, -1) },
  12. {EDir.Left, new Vec2(-1, 0) },
  13. {EDir.Right, new Vec2(1, 0) },
  14. };

初始化上下文&裁剪地图

  1. Context context;
  2. public void Init(int w, int h, int roomCnt, int windingPct, int roomSizeOff)
  3. {
  4. int x = w - w % 2 - 2 - 1;
  5. int y = h - h % 2 - 2 - 1;
  6. context = new Context()
  7. {
  8. size = new Vec2(x, y),
  9. roomCnt = roomCnt,
  10. windingPct = windingPct,
  11. roomSizeOff = roomSizeOff,
  12. map = new int[x, y],
  13. regions = new List<Region>(),
  14. rooms = new List<Room>(),
  15. regionIDIdx = -1,
  16. };
  17. }
  • 地图的长宽都被裁剪成奇数,并内缩一个单位。

生成地图房间

  1. void GenRooms()
  2. {
  3. for (int i = 0; i < context.roomCnt;)
  4. {
  5. var size = R.Range(1, 3 + context.roomSizeOff) * 2 + 1;
  6. var off = R.Range(0, 1 + size / 2) * 2;
  7. var w = size;
  8. var h = size;
  9. if (R.Range(0, 2) > 0)
  10. w += off;
  11. else
  12. h += off;
  13. var x = R.Range(0, (context.size.x - w) / 2) * 2 ;
  14. var y = R.Range(0, (context.size.y - h) / 2) * 2 ;
  15. var rect = new Rect(x, y, w, h);
  16. bool isOverlap = false;
  17. foreach (var room in context.rooms)
  18. if (rect.Overlaps(room.rect))
  19. {
  20. isOverlap = true;
  21. break;
  22. }
  23. if (isOverlap)
  24. continue;
  25. ++i;
  26. GrowRegion();
  27. for (int m = x; m < x + w; m++)
  28. for (int n = y; n < y + h; n++)
  29. Carve(m, n);
  30. context.rooms.Add(new Room(x, y, w, h));
  31. }
  32. }
  • 根据roomCnt参数生成房间
  • 随机生成房间的大小和位置
  • 若是新生成的房间和其他的房间重合则重新生成
  • 生成房间的位置都是奇数,所以每个房间之上隔一个单位

生成迷宫通路

  1. void GenMaze()
  2. {
  3. foreach (var room in context.rooms)
  4. foreach (var pos in room.borders)
  5. if (pos.x % 2 == 0 && pos.y % 2 == 0)
  6. GrowMaze(pos);
  7. }
  8. void GrowMaze(Vec2 pos)
  9. {
  10. Vec2 forward = Vec2.Zero;
  11. var stack = new Stack<Vec2>();
  12. stack.Push(pos);
  13. GrowRegion();
  14. bool isStart = true;
  15. while (stack.Count > 0)
  16. {
  17. var p = stack.Pop();
  18. List<Vec2> dirs = new List<Vec2>();
  19. foreach (var pair in dirDict)
  20. {
  21. var dir = pair.Value;
  22. if (CanMazeGrow(p, dir))
  23. dirs.Add(dir);
  24. }
  25. if (dirs.Count > 0)
  26. {
  27. if (!(dirs.Contains(forward) && R.Range(0, 100) < context.windingPct))
  28. forward = dirs[R.Range(0, dirs.Count)];
  29. if (isStart)
  30. isStart = false;
  31. else
  32. Carve(p + forward);
  33. Carve(p + 2 * forward);
  34. stack.Push(p + 2 * forward);
  35. }
  36. else
  37. forward = Vec2.Zero;
  38. }
  39. TryShrinkRegion();
  40. }
  41. bool CanMazeGrow(Vec2 pos, Vec2 dir)
  42. {
  43. return CanCarve(pos + dir) && CanCarve(pos + 2 * dir);
  44. }
  45. bool CanCarve(Vec2 pos)
  46. {
  47. return CanCarve(pos.x, pos.y);
  48. }
  49. bool CanCarve(int x, int y)
  50. {
  51. return InMap(x, y) && context.map[x, y] == 0;
  52. }
  53. bool InMap(Vec2 pos)
  54. {
  55. return InMap(pos.x, pos.y);
  56. }
  57. bool InMap(int x, int y)
  58. {
  59. var size = context.size;
  60. return x >= 0 && x < size.x && y >= 0 && y < size.y;
  61. }
  62. void Carve(Vec2 pos, int ty = 1)
  63. {
  64. Carve(pos.x, pos.y, ty);
  65. }
  66. void Carve(int x, int y, int ty = 1)
  67. {
  68. context.map[x, y] = ty;
  69. context.regions[context.regionIDIdx].positions.Add(new Vec2(x, y));
  70. }
  • 从每个房间的边缘XY为奇数尝试生长迷宫通路
  • 递归的生长迷宫向四周探测两个单位,符合条件则向那个方向生长两个单位,直到不能生长
  • 若至少生长了一次,则形成一个迷宫通路区域
  • 第一次生长时,为了避免后面影响连接的计算,第一次的第一个单位填充被忽略

连接区域

  1. void Connect()
  2. {
  3. for (int i = 0; i < context.rooms.Count; i++)
  4. {
  5. context.regions[i].positions.Clear();
  6. foreach (var pos in context.rooms[i].borders)
  7. context.regions[i].positions.Add(pos);
  8. }
  9. Dictionary<int, Region> dict = new Dictionary<int, Region>();
  10. for (int i = 0; i < context.regions.Count; i++)
  11. dict[i] = context.regions[i];
  12. var idxs = new List<int>();
  13. while (dict.Count > 1)
  14. {
  15. idxs.Clear();
  16. foreach (var pair in dict)
  17. idxs.Add(pair.Key);
  18. var dest = idxs[idxs.Count - 1];
  19. idxs.RemoveAt(idxs.Count - 1);
  20. bool isMerge = false;
  21. foreach (var idx in idxs)
  22. {
  23. var connectPos = Vec2.Zero;
  24. if (TryConnectRegion(dict[dest], dict[idx], out connectPos))
  25. {
  26. GrowRegion();
  27. dict[context.regionIDIdx] = context.regions[context.regionIDIdx];
  28. foreach (var pos in dict[dest].positions)
  29. dict[context.regionIDIdx].positions.Add(pos);
  30. foreach (var pos in dict[idx].positions)
  31. dict[context.regionIDIdx].positions.Add(pos);
  32. Carve(connectPos);
  33. dict.Remove(dest);
  34. dict.Remove(idx);
  35. isMerge = true;
  36. break;
  37. }
  38. }
  39. if (!isMerge)
  40. {
  41. Debug.Log("Region Merge Failed!");
  42. return;
  43. }
  44. }
  45. }
  46. bool TryConnectRegion(Region a, Region b, out Vec2 connectPos)
  47. {
  48. for (int i = 0; i < a.positions.Count; i++)
  49. {
  50. var ap = a.positions[i];
  51. if (ap.x % 2 == 0 && ap.y % 2 == 0)
  52. for (int j = 0; j < b.positions.Count; j++)
  53. {
  54. var bp = b.positions[j];
  55. if (bp.x % 2 == 0 && bp.y % 2 == 0)
  56. if (ap.y == bp.y)
  57. {
  58. if (ap.x - bp.x == 2)
  59. {
  60. connectPos = ap + new Vec2(-1, 0);
  61. return true;
  62. }
  63. if (ap.x - bp.x == -2)
  64. {
  65. connectPos = ap + new Vec2(1, 0);
  66. return true;
  67. }
  68. }
  69. else if (ap.x == bp.x)
  70. {
  71. if (ap.y - bp.y == 2)
  72. {
  73. connectPos = ap + new Vec2(0, -1);
  74. return true;
  75. }
  76. if (ap.y - bp.y == -2)
  77. {
  78. connectPos = ap + new Vec2(0, 1);
  79. return true;
  80. }
  81. }
  82. }
  83. }
  84. connectPos = Vec2.Zero;
  85. return false;
  86. }
  • 递归的对区域进行两两合并
  • 两个区域若是各自存在一个格子,若是这两个格子的距离为2个单位则这两个单位可通过Lerp(格子a,格子b,0.5)这个格子连接,这两个区域合并成为一个区域。
  • 若是有需要可以判断两个区域中是否有房间,可以把这个格子作为"门"之类的东西。

裁剪迷宫通路

  1. void CutMaze()
  2. {
  3. var region = context.regions[context.regionIDIdx];
  4. List<Vec2> dirs = new List<Vec2>();
  5. foreach (var pos in region.positions)
  6. CutMazeArrangement(pos);
  7. }
  8. void CutMazeArrangement(Vec2 pos)
  9. {
  10. if (context.map[pos.x, pos.y] == 0)
  11. return;
  12. List<Vec2> dirs = new List<Vec2>();
  13. foreach (var pair in dirDict)
  14. {
  15. var dir = pair.Value;
  16. var test = pos + dir;
  17. if (!InMap(test))
  18. continue;
  19. if (context.map[test.x, test.y] == 1)
  20. dirs.Add(test);
  21. }
  22. if (dirs.Count == 1)
  23. {
  24. context.map[pos.x, pos.y] = 0;
  25. CutMazeArrangement(dirs[0]);
  26. }
  27. }
  • 递归的检查所有迷宫通路的格子,若是此格子的连通方向只有一个,则消除此格子。

完整代码

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using R = UnityEngine.Random;
  5. public struct Vec2
  6. {
  7. public int x;
  8. public int y;
  9. public Vec2(int x, int y)
  10. {
  11. this.x = x;
  12. this.y = y;
  13. }
  14. public static Vec2 Zero
  15. {
  16. get
  17. {
  18. return new Vec2(0, 0);
  19. }
  20. }
  21. public override bool Equals(object obj)
  22. {
  23. if (!(obj is Vec2))
  24. return false;
  25. var o = (Vec2)obj;
  26. return x == o.x && y == o.y;
  27. }
  28. public override int GetHashCode()
  29. {
  30. return x.GetHashCode() + y.GetHashCode();
  31. }
  32. public static Vec2 operator+ (Vec2 a, Vec2 b)
  33. {
  34. return new Vec2(a.x + b.x, a.y + b.y);
  35. }
  36. public static Vec2 operator* (Vec2 a, int n)
  37. {
  38. return new Vec2(a.x * n, a.y * n);
  39. }
  40. public static Vec2 operator* (int n, Vec2 a)
  41. {
  42. return new Vec2(a.x * n, a.y * n);
  43. }
  44. public static bool operator== (Vec2 a, Vec2 b)
  45. {
  46. return a.x == b.x && a.y == b.y;
  47. }
  48. public static bool operator !=(Vec2 a, Vec2 b)
  49. {
  50. return !(a.x == b.x && a.y == b.y);
  51. }
  52. }
  53. public enum EDir
  54. {
  55. Up = 0,
  56. Down = 1,
  57. Left = 2,
  58. Right = 3,
  59. }
  60. public class DungeonBuild
  61. {
  62. public struct Region
  63. {
  64. public int id;
  65. public List<Vec2> positions;
  66. public Region(int id)
  67. {
  68. this.id = id;
  69. positions = new List<Vec2>();
  70. }
  71. }
  72. struct Room
  73. {
  74. public Rect rect;
  75. public List<Vec2> borders;
  76. public Room(int x, int y, int w, int h)
  77. {
  78. rect = new Rect(x, y, w, h);
  79. borders = new List<Vec2>();
  80. for (int i = x; i <= x + w; i++)
  81. for (int j = y; j <= y + h; j++)
  82. if (!(i > x && x < x + w && j > y && j < y + h))
  83. borders.Add(new Vec2(i, j));
  84. }
  85. }
  86. struct Context
  87. {
  88. public Vec2 size;
  89. public int roomCnt;
  90. public int windingPct;
  91. public int roomSizeOff;
  92. public int[,] map;
  93. public List<Region> regions;
  94. public List<Room> rooms;
  95. public int regionIDIdx;
  96. }
  97. static Dictionary<EDir, Vec2> dirDict = new Dictionary<EDir, Vec2>
  98. {
  99. {EDir.Up, new Vec2(0, 1) },
  100. {EDir.Down, new Vec2(0, -1) },
  101. {EDir.Left, new Vec2(-1, 0) },
  102. {EDir.Right, new Vec2(1, 0) },
  103. };
  104. Context context;
  105. public void Init(int w, int h, int roomCnt, int windingPct, int roomSizeOff)
  106. {
  107. int x = w - w % 2 - 2 - 1;
  108. int y = h - h % 2 - 2 - 1;
  109. context = new Context()
  110. {
  111. size = new Vec2(x, y),
  112. roomCnt = roomCnt,
  113. windingPct = windingPct,
  114. roomSizeOff = roomSizeOff,
  115. map = new int[x, y],
  116. regions = new List<Region>(),
  117. rooms = new List<Room>(),
  118. regionIDIdx = -1,
  119. };
  120. }
  121. public void Build()
  122. {
  123. GenRooms();
  124. GenMaze();
  125. Connect();
  126. CutMaze();
  127. }
  128. public int[,] GetResult()
  129. {
  130. return context.map;
  131. }
  132. public Vector2 GetSize()
  133. {
  134. return new Vector2(context.size.x, context.size.y);
  135. }
  136. void GrowRegion()
  137. {
  138. context.regionIDIdx++;
  139. context.regions.Add(new Region(context.regionIDIdx));
  140. }
  141. void TryShrinkRegion()
  142. {
  143. if (context.regions[context.regionIDIdx].positions.Count == 0)
  144. {
  145. context.regions.RemoveAt(context.regionIDIdx);
  146. context.regionIDIdx--;
  147. }
  148. }
  149. void GenRooms()
  150. {
  151. for (int i = 0; i < context.roomCnt;)
  152. {
  153. var size = R.Range(1, 3 + context.roomSizeOff) * 2 + 1;
  154. var off = R.Range(0, 1 + size / 2) * 2;
  155. var w = size;
  156. var h = size;
  157. if (R.Range(0, 2) > 0)
  158. w += off;
  159. else
  160. h += off;
  161. var x = R.Range(0, (context.size.x - w) / 2) * 2 ;
  162. var y = R.Range(0, (context.size.y - h) / 2) * 2 ;
  163. var rect = new Rect(x, y, w, h);
  164. bool isOverlap = false;
  165. foreach (var room in context.rooms)
  166. if (rect.Overlaps(room.rect))
  167. {
  168. isOverlap = true;
  169. break;
  170. }
  171. if (isOverlap)
  172. continue;
  173. ++i;
  174. GrowRegion();
  175. for (int m = x; m < x + w; m++)
  176. for (int n = y; n < y + h; n++)
  177. Carve(m, n);
  178. context.rooms.Add(new Room(x, y, w, h));
  179. }
  180. }
  181. void GenMaze()
  182. {
  183. foreach (var room in context.rooms)
  184. foreach (var pos in room.borders)
  185. if (pos.x % 2 == 0 && pos.y % 2 == 0)
  186. GrowMaze(pos);
  187. }
  188. void GrowMaze(Vec2 pos)
  189. {
  190. Vec2 forward = Vec2.Zero;
  191. var stack = new Stack<Vec2>();
  192. stack.Push(pos);
  193. GrowRegion();
  194. bool isStart = true;
  195. while (stack.Count > 0)
  196. {
  197. var p = stack.Pop();
  198. List<Vec2> dirs = new List<Vec2>();
  199. foreach (var pair in dirDict)
  200. {
  201. var dir = pair.Value;
  202. if (CanMazeGrow(p, dir))
  203. dirs.Add(dir);
  204. }
  205. if (dirs.Count > 0)
  206. {
  207. if (!(dirs.Contains(forward) && R.Range(0, 100) < context.windingPct))
  208. forward = dirs[R.Range(0, dirs.Count)];
  209. if (isStart)
  210. isStart = false;
  211. else
  212. Carve(p + forward);
  213. Carve(p + 2 * forward);
  214. stack.Push(p + 2 * forward);
  215. }
  216. else
  217. forward = Vec2.Zero;
  218. }
  219. TryShrinkRegion();
  220. }
  221. void Connect()
  222. {
  223. for (int i = 0; i < context.rooms.Count; i++)
  224. {
  225. context.regions[i].positions.Clear();
  226. foreach (var pos in context.rooms[i].borders)
  227. context.regions[i].positions.Add(pos);
  228. }
  229. Dictionary<int, Region> dict = new Dictionary<int, Region>();
  230. for (int i = 0; i < context.regions.Count; i++)
  231. dict[i] = context.regions[i];
  232. var idxs = new List<int>();
  233. while (dict.Count > 1)
  234. {
  235. idxs.Clear();
  236. foreach (var pair in dict)
  237. idxs.Add(pair.Key);
  238. var dest = idxs[idxs.Count - 1];
  239. idxs.RemoveAt(idxs.Count - 1);
  240. bool isMerge = false;
  241. foreach (var idx in idxs)
  242. {
  243. var connectPos = Vec2.Zero;
  244. if (TryConnectRegion(dict[dest], dict[idx], out connectPos))
  245. {
  246. GrowRegion();
  247. dict[context.regionIDIdx] = context.regions[context.regionIDIdx];
  248. foreach (var pos in dict[dest].positions)
  249. dict[context.regionIDIdx].positions.Add(pos);
  250. foreach (var pos in dict[idx].positions)
  251. dict[context.regionIDIdx].positions.Add(pos);
  252. Carve(connectPos);
  253. dict.Remove(dest);
  254. dict.Remove(idx);
  255. isMerge = true;
  256. break;
  257. }
  258. }
  259. if (!isMerge)
  260. {
  261. Debug.Log("Region Merge Failed!");
  262. return;
  263. }
  264. }
  265. }
  266. bool TryConnectRegion(Region a, Region b, out Vec2 connectPos)
  267. {
  268. for (int i = 0; i < a.positions.Count; i++)
  269. {
  270. var ap = a.positions[i];
  271. if (ap.x % 2 == 0 && ap.y % 2 == 0)
  272. for (int j = 0; j < b.positions.Count; j++)
  273. {
  274. var bp = b.positions[j];
  275. if (bp.x % 2 == 0 && bp.y % 2 == 0)
  276. if (ap.y == bp.y)
  277. {
  278. if (ap.x - bp.x == 2)
  279. {
  280. connectPos = ap + new Vec2(-1, 0);
  281. return true;
  282. }
  283. if (ap.x - bp.x == -2)
  284. {
  285. connectPos = ap + new Vec2(1, 0);
  286. return true;
  287. }
  288. }
  289. else if (ap.x == bp.x)
  290. {
  291. if (ap.y - bp.y == 2)
  292. {
  293. connectPos = ap + new Vec2(0, -1);
  294. return true;
  295. }
  296. if (ap.y - bp.y == -2)
  297. {
  298. connectPos = ap + new Vec2(0, 1);
  299. return true;
  300. }
  301. }
  302. }
  303. }
  304. connectPos = Vec2.Zero;
  305. return false;
  306. }
  307. void CutMaze()
  308. {
  309. var region = context.regions[context.regionIDIdx];
  310. List<Vec2> dirs = new List<Vec2>();
  311. foreach (var pos in region.positions)
  312. CutMazeArrangement(pos);
  313. }
  314. void CutMazeArrangement(Vec2 pos)
  315. {
  316. if (context.map[pos.x, pos.y] == 0)
  317. return;
  318. List<Vec2> dirs = new List<Vec2>();
  319. foreach (var pair in dirDict)
  320. {
  321. var dir = pair.Value;
  322. var test = pos + dir;
  323. if (!InMap(test))
  324. continue;
  325. if (context.map[test.x, test.y] == 1)
  326. dirs.Add(test);
  327. }
  328. if (dirs.Count == 1)
  329. {
  330. context.map[pos.x, pos.y] = 0;
  331. CutMazeArrangement(dirs[0]);
  332. }
  333. }
  334. bool CanMazeGrow(Vec2 pos, Vec2 dir)
  335. {
  336. return CanCarve(pos + dir) && CanCarve(pos + 2 * dir);
  337. }
  338. bool CanCarve(Vec2 pos)
  339. {
  340. return CanCarve(pos.x, pos.y);
  341. }
  342. bool CanCarve(int x, int y)
  343. {
  344. return InMap(x, y) && context.map[x, y] == 0;
  345. }
  346. bool InMap(Vec2 pos)
  347. {
  348. return InMap(pos.x, pos.y);
  349. }
  350. bool InMap(int x, int y)
  351. {
  352. var size = context.size;
  353. return x >= 0 && x < size.x && y >= 0 && y < size.y;
  354. }
  355. void Carve(Vec2 pos, int ty = 1)
  356. {
  357. Carve(pos.x, pos.y, ty);
  358. }
  359. void Carve(int x, int y, int ty = 1)
  360. {
  361. context.map[x, y] = ty;
  362. context.regions[context.regionIDIdx].positions.Add(new Vec2(x, y));
  363. }
  364. }

原文链接:https://www.cnblogs.com/hggzhang/p/16971561.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号