Exemplo n.º 1
0
        public Map(Game game, Vector3 start, int mapSeed)
            : base(game)
        {
            this.start             = start;
            this.game              = game;
            this.device            = this.game.GraphicsDevice;
            this.camera            = this.game.Services.GetService(typeof(ICameraService)) as ICameraService;
            this.defaultEfft       = new BasicEffect(this.device);
            this.prevKeyboardState = Keyboard.GetState();

            if (this.camera == null)
            {
                throw new InvalidOperationException("ICameraService not found.");
            }

            this.internalMap = new InternalMap(160, 80, 8, 8, mapSeed);//new InternalMap(width, heigh, 8, 8);
            this.internalMap.GenerateRandomMap();
            this.internalMap.OptimizeMap();
            this.drawableRandomMapNode    = new DrawableGameComponent[this.internalMap.MapNodeHeight, this.internalMap.MapNodeWidth];
            this.drawableOptimizedMapNode = new DrawableGameComponent[this.internalMap.MapNodeHeight, this.internalMap.MapNodeWidth];
            this.convertMapNodes(this.drawableRandomMapNode, this.internalMap.InternalMapStruct);
            this.convertMapNodes(this.drawableOptimizedMapNode, this.internalMap.OptimizedMapStruct);
            //this.internalMap.printMaps();
        }
Exemplo n.º 2
0
        public Map(Game game, Vector3 start, int mapSeed)
            : base(game)
        {
            this.start = start;
            this.game = game;
            this.device = this.game.GraphicsDevice;
            this.camera = this.game.Services.GetService(typeof(ICameraService)) as ICameraService;
            this.defaultEfft = new BasicEffect(this.device);
            this.prevKeyboardState = Keyboard.GetState();

            if (this.camera == null)
            {
                throw new InvalidOperationException("ICameraService not found.");
            }

            this.internalMap = new InternalMap(160, 80, 8, 8, mapSeed);//new InternalMap(width, heigh, 8, 8);
            this.internalMap.GenerateRandomMap();
            this.internalMap.OptimizeMap();
            this.drawableRandomMapNode = new DrawableGameComponent[this.internalMap.MapNodeHeight, this.internalMap.MapNodeWidth];
            this.drawableOptimizedMapNode = new DrawableGameComponent[this.internalMap.MapNodeHeight, this.internalMap.MapNodeWidth];
            this.convertMapNodes(this.drawableRandomMapNode, this.internalMap.InternalMapStruct);
            this.convertMapNodes(this.drawableOptimizedMapNode, this.internalMap.OptimizedMapStruct);
            //this.internalMap.printMaps();
        }