|
5 | 5 | using System; |
6 | 6 | using System.Collections.Concurrent; |
7 | 7 | using System.Collections.Generic; |
| 8 | +using System.Linq; |
8 | 9 | using static System.Formats.Asn1.AsnWriter; |
9 | 10 |
|
10 | 11 | namespace Gaming |
@@ -82,15 +83,21 @@ private void InitTeams() |
82 | 83 | // MapInfo 中 defaultMap 的工厂位置是 [3,3], [3,46], [46,3], [46,46] |
83 | 84 | var corners = new (int cx, int cy)[] |
84 | 85 | { |
85 | | - (3, 3), // Team 1 工厂位置 |
86 | | - (3, 46), // Team 2 工厂位置 |
87 | | - (46, 3), // Team 3 工厂位置 |
88 | | - (46, 46) // Team 4 工厂位置 |
| 86 | + (3, 3), // 角0 — 左下 |
| 87 | + (3, 46), // 角1 — 左上 |
| 88 | + (46, 3), // 角2 — 右下 |
| 89 | + (46, 46) // 角3 — 右上 |
89 | 90 | }; |
90 | | - for (int i = 0; i < 4; i++) |
| 91 | + int[] selected = numOfTeam switch |
| 92 | + { |
| 93 | + 2 => new[] { 0, 3 }, // 对角线 |
| 94 | + 3 => new[] { 0, 1, 3 }, // 三角形 |
| 95 | + _ => Enumerable.Range(0, numOfTeam).ToArray() |
| 96 | + }; |
| 97 | + for (int i = 0; i < numOfTeam; i++) |
91 | 98 | { |
92 | 99 | long teamId = i + 1; |
93 | | - var (cx, cy) = corners[i]; |
| 100 | + var (cx, cy) = corners[selected[i]]; |
94 | 101 | XY pos = GameData.GetCellCenterPos(cx, cy); |
95 | 102 | var fac = new Factory(pos); |
96 | 103 | fac.TeamID.SetROri(teamId); |
|
0 commit comments