Exemple #1
0
 public AProjectile(Projectile proj)
 {
     Type = proj.Type;
     X = proj.X;
     Y = proj.Y;
     Speed = new Point(proj.SpeedX, proj.SpeedY);
     Radius = proj.Radius;
 }
        public World(int tick, int tickCount, int lastTickIndex, int width, int height, Player[] players, Car[] cars,
                Projectile[] projectiles, Bonus[] bonuses, OilSlick[] oilSlicks, string mapName, TileType[][] tilesXY,
                int[][] waypoints, Direction startingDirection)
        {
            this.tick = tick;
            this.tickCount = tickCount;
            this.lastTickIndex = lastTickIndex;
            this.width = width;
            this.height = height;

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

            this.cars = new Car[cars.Length];
            Array.Copy(cars, this.cars, cars.Length);

            this.projectiles = new Projectile[projectiles.Length];
            Array.Copy(projectiles, this.projectiles, projectiles.Length);

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

            this.oilSlicks = new OilSlick[oilSlicks.Length];
            Array.Copy(oilSlicks, this.oilSlicks, oilSlicks.Length);

            this.mapName = mapName;

            this.tilesXY = new TileType[tilesXY.Length][];
            for (int i = tilesXY.Length - 1; i >= 0; --i) {
                this.tilesXY[i] = new TileType[tilesXY[i].Length];
                Array.Copy(tilesXY[i], this.tilesXY[i], tilesXY[i].Length);
            }

            this.waypoints = new int[waypoints.Length][];
            for (int i = waypoints.Length - 1; i >= 0; --i) {
                this.waypoints[i] = new int[waypoints[i].Length];
                Array.Copy(waypoints[i], this.waypoints[i], waypoints[i].Length);
            }

            this.startingDirection = startingDirection;
        }