public Arena CreateArena(int limitNum, List <AccountData> accs) { Arena arena = new Arena(); arena.accounts = accs; arena.battleid = battleidCounter++; arena.limitNum = limitNum; arena.type = EBattle.Arena; //为每个账号创建一个坦克 for (int i = 0; i < accs.Count; i++) { AccountData a = accs[i]; a.battleid = arena.battleid; Tank t = new Tank(); t.uid = a.account; t.hp = 100; t.nickName = a.nickname; t.team = i % 2 == 0 ? ETeam.Red : ETeam.Blue; //真随机 Random r = new Random(System.Guid.NewGuid().GetHashCode()); t.color = t.team == ETeam.Red ? new Color { r = 1, g = 0, b = 0 } : new Color { r = 0, g = 0, b = 1 }; t.pos = SpawnPoint.point[r.Next(0, 5)]; a.team = t.team; a.battleType = EBattle.Arena; arena.AddTank(t); } arenas.Add(arena); return(arena); }