Exemple #1
0
 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 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);
                waves.Enqueue(wave);
            }

            StartNextWave();
        }
Exemple #3
0
        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);
            Texture2D enemyTexture = Content.Load<Texture2D>("enemy");

            /*enemy1 = new Enemy(enemyTexture, Vector2.Zero, 100, 10, 0.5f);
            enemy1.SetWaypoints(level.Waypoints);
            wave = new Wave(0, 10, level, enemyTexture);
            wave.Start();
            Texture2D towerTexture = Content.Load<Texture2D>("tower");
            tower = new Tower(towerTexture, Vector2.Zero);
            player = new Player(level, towerTexture);*/

            Texture2D towerTexture = Content.Load<Texture2D>("tower");
            Texture2D bulletTexture = Content.Load<Texture2D>("bullet");
            player = new Player(level, towerTexture, bulletTexture);
            waveManager = new WaveManager(player, level, 30, enemyTexture);
            Texture2D topBar = Content.Load<Texture2D>("toolbar");
            SpriteFont font = Content.Load<SpriteFont>("Arial");
            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);
        }
Exemple #4
0
 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);
 }