public World(int tick, double width, double height, Player[] players, Obstacle[] obstacles, Tank[] tanks, Shell[] shells, Bonus[] bonuses) { this.tick = tick; this.width = width; this.height = height; this.players = new Player[players.Length]; Array.Copy(players, this.players, players.Length); this.obstacles = new Obstacle[obstacles.Length]; Array.Copy(obstacles, this.obstacles, obstacles.Length); this.tanks = new Tank[tanks.Length]; Array.Copy(tanks, this.tanks, tanks.Length); this.shells = new Shell[shells.Length]; Array.Copy(shells, this.shells, shells.Length); this.bonuses = new Bonus[bonuses.Length]; Array.Copy(bonuses, this.bonuses, bonuses.Length); }
private Obstacle[] ReadObstacles() { int obstacleCount = ReadInt(); if (obstacleCount < 0) { return null; } Obstacle[] obstacles = new Obstacle[obstacleCount]; for (int obstacleIndex = 0; obstacleIndex < obstacleCount; ++obstacleIndex) { if (ReadBoolean()) { obstacles[obstacleIndex] = new Obstacle(ReadLong(), ReadDouble(), ReadDouble(), ReadDouble(), ReadDouble()); } } return obstacles; }