public Wave(int waveNumber, int numOfEnemies, Player player, Level level, Texture2D enemyTexture) { this.waveNumber = waveNumber; this.numOfEnemies = numOfEnemies; this.player = player; this.level = level; this.enemyTexture = enemyTexture; }
//public Wave(int waveNumber, int numOfEnemies, Player player, Level level, Texture2D enemyTexture) public Wave(int waveNumber, int numOfEnemies, Player player, Level level, Texture2D[] enemyTextureList, float[] enemyHealthList) { this.waveNumber = waveNumber; this.numOfEnemies = numOfEnemies; this.player = player; this.level = level; //this.enemyTexture = enemyTexture; this.enemyTexture = enemyTextureList; this.enemyHealthList = enemyHealthList; }
public WaveManager(Player player, Level level, int numberOfWaves, Texture2D[] enemyTexture) { this.numberOfWaves = numberOfWaves; this.enemyTexture = enemyTexture; this.level = level; for (int i = 0; i < numberOfWaves; i++) { int initialNumberOfEnemies = 6; int numberModifier = i + 1; Wave wave = new Wave(i, initialNumberOfEnemies * numberModifier, player, level, enemyTexture[i%2]); waves.Enqueue(wave); } StartNextWave(); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); Texture2D grass = Content.Load<Texture2D>("grass"); Texture2D path = Content.Load<Texture2D>("path"); level.AddTexture(grass); level.AddTexture(path); enemyTexture[0] = Content.Load<Texture2D>("enemy"); enemyTexture[1]=Content.Load<Texture2D>("enemy2"); // enemyHealth [0]= ; //enemyHealth [1]= ; arial = Content.Load<SpriteFont>("Arial"); lucida = Content.Load<SpriteFont>("Lucida"); Texture2D towerTexture = Content.Load<Texture2D>("tower"); Texture2D bulletTexture = Content.Load<Texture2D>("bullet"); bulletSound = Content.Load<SoundEffect>("gunShot"); player = new Player(level, towerTexture, bulletTexture,Content); // waveManager = new WaveManager(player, level, 30, enemyTexture); waveManager = new WaveManager(player, level, 30, enemyTexture, enemyHealth); SpriteFont font = Content.Load<SpriteFont>("Arial"); Texture2D topBar = Content.Load<Texture2D>("toolbar"); toolbar = new Toolbar(topBar, font, new Vector2(0, level.Height * 32)); Texture2D arrowNormal = Content.Load<Texture2D>("GUI\\Arrow Tower\\arrow normal"); Texture2D arrowHover = Content.Load<Texture2D>("GUI\\Arrow Tower\\arrow hover"); Texture2D arrowPressed = Content.Load<Texture2D>("GUI\\Arrow Tower\\arrow pressed"); arrowButton = new Button(arrowNormal, arrowHover, arrowPressed, new Vector2(0, level.Height * 32)); arrowButton.Clicked += new EventHandler(arrowButton_Clicked); Texture2D pausetexture = Content.Load<Texture2D>("pause"); Texture2D playtexture = Content.Load<Texture2D>("play"); button1=new Button1(pausetexture, playtexture, new Vector2(35, level.Height * 32 + 3)); }
public void Draw(SpriteBatch spriteBatch, Player player) { spriteBatch.Draw(texture, position, Color.White); string text = string.Format("Gold : {0} Lives : {1}", player.Money, player.Lives); spriteBatch.DrawString(font, text, textPosition, Color.White); }