示例#1
0
        public void AddGameMap()
        {
            var longWallPrototype   = new Wall(0, 0, 0, 0, 500, 100);
            var tallWallPrototype   = new Wall(0, 0, 0, 0, 100, 500);
            var squareWallPrototype = new Wall(0, 0, 0, 0, 100, 100);

            const int numberOfWalls = 2;
            var       random        = new Random();

            TerrainObjectCollection walls = new TerrainObjectCollection();

            //var walls = new List<GameObject>();

            for (var i = 0; i < numberOfWalls; i++)
            {
                Wall wall;
                switch (random.Next(1, 4))
                {
                case 1:
                    wall = squareWallPrototype.Clone();
                    break;

                case 2:
                    wall = longWallPrototype.Clone();
                    break;

                case 3:
                    wall = tallWallPrototype.Clone();
                    break;

                default:
                    wall = squareWallPrototype.Clone();
                    break;
                }

                wall.State.X = random.Next(200, 500);
                wall.State.Y = random.Next(200, 500);

                /*
                 * wall.State.X = 300;
                 * wall.State.Y = 200;*/

                walls[i] = wall;
            }

            _gameState.Map = new GameMap
            {
                TerrainObjects = walls
            };
        }
示例#2
0
 public Iterator(TerrainObjectCollection collection)
 {
     this._collection = collection;
 }