예제 #1
0
        public World(int moveIndex, int width, int height, Player[] players, Trooper[] troopers, Bonus[] bonuses,
            CellType[][] cells, bool[] cellVisibilities)
        {
            this.moveIndex = moveIndex;
            this.width = width;
            this.height = height;

            this.players = new Player[players.Length];
            Array.Copy(players, this.players, players.Length);

            this.troopers = new Trooper[troopers.Length];
            Array.Copy(troopers, this.troopers, troopers.Length);

            this.bonuses = new Bonus[bonuses.Length];
            Array.Copy(bonuses, this.bonuses, bonuses.Length);

            this.cells = new CellType[width][];
            for (int x = 0; x < width; ++x)
            {
                this.cells[x] = new CellType[cells[x].Length];
                Array.Copy(cells[x], this.cells[x], cells[x].Length);
            }

            this.cellVisibilities = cellVisibilities;
        }
예제 #2
0
        private Player[] ReadPlayers()
        {
            int playerCount = ReadInt();
            if (playerCount < 0)
            {
                return null;
            }

            Player[] players = new Player[playerCount];

            for (int playerIndex = 0; playerIndex < playerCount; ++playerIndex)
            {
                if (ReadBoolean())
                {
                    players[playerIndex] = new Player(ReadLong(), ReadString(), ReadInt(), ReadBoolean(),
                        ReadInt(), ReadInt());
                }
            }

            return players;
        }