public void drop(WeaponCollection weapons) { if (weapon != null) { weapons.Add(weapon); weapon = null; } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); fill = loadColorTexture(Color.White); sans = Content.Load <SpriteFont>("sans"); // load in the textures for heros List <Texture2D> heroTextures = new List <Texture2D>(); // load textures into the list Texture2D heroTex = Content.Load <Texture2D>("newBasic"); heroTextures.Add(heroTex); Texture2D chungTex = Content.Load <Texture2D>("chungus"); heroTextures.Add(chungTex); Texture2D dogeTex = Content.Load <Texture2D>("doge"); heroTextures.Add(dogeTex); Texture2D blockTex = Content.Load <Texture2D>("blocks"); Texture2D weaponsTex = Content.Load <Texture2D>("weapons"); players = new PlayerCollection(heroTextures, UNIT_SIZE / 3 * 2, UNIT_SIZE, sans, fill); Texture2D wallTexture = loadColorTexture(Color.DarkGreen); walls = new WallCollection(wallTexture, TILE_SIZE); //walls.createBlock(0, 200, screenWidth, screenHeight); builder = new Builder(walls, sans, fill, heroTex, UNIT_SIZE / 3 * 2, UNIT_SIZE, weaponsTex, UNIT_SIZE, UNIT_SIZE / 2); builder.loadMap("last.gmd"); // delete this sometime players.AddPlayer(new Point(100, 100), Heros.Chungus, "player 1", Color.Red, Keys.Left, Keys.Right, Keys.Up, Keys.Space); players.AddPlayer(new Point(200, 100), Heros.Doge, "Player 2", Color.Blue, Keys.A, Keys.D, Keys.W, Keys.LeftShift); weapons = new WeaponCollection(); Gun gun = new Gun(new Rectangle(0, 0, UNIT_SIZE, UNIT_SIZE / 2), weaponsTex, fill, 2); weapons.Add(gun); mainMenu = new Menus(sans, fill); // TODO: use this.Content to load your game content here }