public PowerupController(GraphicsDevice gd) { Instance = this; graphicsDevice = gd; Powerups = new List<Powerup>(MAX_POWERUPS); for (int i = 0; i < MAX_POWERUPS; i++) Powerups.Add(new Powerup()); }
public PowerupController(GraphicsDevice gd) { Instance = this; graphicsDevice = gd; Powerups = new List <Powerup>(MAX_POWERUPS); for (int i = 0; i < MAX_POWERUPS; i++) { Powerups.Add(new Powerup()); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); font = Content.Load<SpriteFont>("font"); hudTex = Content.Load<Texture2D>("hud"); tilesSprite = new VoxelSprite(16, 16, 16); LoadVoxels.LoadSprite(Path.Combine(Content.RootDirectory, "tiles.vxs"), ref tilesSprite); gameMap = Content.Load<Map>("1"); tileLayer = (TileLayer)gameMap.GetLayer("tiles"); MapObjectLayer spawnLayer = (MapObjectLayer)gameMap.GetLayer("spawns"); gameWorld = new VoxelWorld(gameMap.Width, 11, 1); for(int yy=0;yy<11;yy++) for(int xx=0;xx<12;xx++) if(tileLayer.Tiles[xx,yy]!=null) gameWorld.CopySprite(xx*Chunk.X_SIZE, yy*Chunk.Y_SIZE, 0, tilesSprite.AnimChunks[tileLayer.Tiles[xx,yy].Index-1]); scrollColumn = 12; gameCamera = new Camera(GraphicsDevice, GraphicsDevice.Viewport); gameCamera.Position = new Vector3(0f, gameWorld.Y_SIZE * Voxel.HALF_SIZE, 0f); gameCamera.Target = gameCamera.Position; gameHero = new Hero(); gameHero.LoadContent(Content, GraphicsDevice); enemyController = new EnemyController(GraphicsDevice); enemyController.LoadContent(Content, spawnLayer); projectileController = new ProjectileController(GraphicsDevice); projectileController.LoadContent(Content); particleController = new ParticleController(GraphicsDevice); powerupController = new PowerupController(GraphicsDevice); powerupController.LoadContent(Content); gameStarfield = new Starfield(GraphicsDevice); drawEffect = new BasicEffect(GraphicsDevice) { World = gameCamera.worldMatrix, View = gameCamera.viewMatrix, Projection = gameCamera.projectionMatrix, VertexColorEnabled = true, }; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); font = Content.Load<SpriteFont>("font"); hudTex = Content.Load<Texture2D>("hud"); tilesSprite = new VoxelSprite(16, 16, 16); LoadVoxels.LoadSprite(Path.Combine(Content.RootDirectory, "tiles.vxs"), ref tilesSprite); gameMap = Content.Load<Map>("1"); tileLayer = (TileLayer)gameMap.GetLayer("tiles"); MapObjectLayer spawnLayer = (MapObjectLayer)gameMap.GetLayer("spawns"); gameWorld = new VoxelWorld(gameMap.Width, 11, 1); for(int yy=0;yy<11;yy++) for(int xx=0;xx<12;xx++) if(tileLayer.Tiles[xx,yy]!=null) gameWorld.CopySprite(xx*Chunk.X_SIZE, yy*Chunk.Y_SIZE, 0, tilesSprite.AnimChunks[tileLayer.Tiles[xx,yy].Index-1]); scrollColumn = 12; gameCamera = new Camera(GraphicsDevice, GraphicsDevice.Viewport); gameCamera.Position = new Vector3(0f, gameWorld.Y_SIZE * Voxel.HALF_SIZE, 0f); gameCamera.Target = gameCamera.Position; gameHero = new Hero(); gameHero.LoadContent(Content, GraphicsDevice); enemyController = new EnemyController(GraphicsDevice); enemyController.LoadContent(Content, spawnLayer); projectileController = new ProjectileController(GraphicsDevice); projectileController.LoadContent(Content); particleController = new ParticleController(GraphicsDevice); powerupController = new PowerupController(GraphicsDevice); powerupController.LoadContent(Content); gameStarfield = new Starfield(GraphicsDevice); drawEffect = new BasicEffect(GraphicsDevice) { World = gameCamera.worldMatrix, View = gameCamera.viewMatrix, Projection = gameCamera.projectionMatrix, VertexColorEnabled = true, }; }