public Wave(int waveNumber, int numOfStudents,
            Player player, Map map, Texture2D[] studentTextureArray)
        {
            /*A new wave of students*/
            this.waveNumber = waveNumber;
            this.numOfStudents = numOfStudents;

            this.player = player;
            this.map = map;

            this.studentTextureArray = studentTextureArray;
        }
Exemple #2
0
        public void Draw(SpriteBatch spriteBatch, Player player, int waveNumber, int totalWaveNumber)
        {
            spriteBatch.Draw(texture, position, Color.White);

            string text = string.Format("Gold : {0} Lives : {1}", player.Money, player.Lives);
            string help = string.Format("Press \"H\" to view \"Help\"\nPress \"Esc\" to view \"Main Menu\"");
            string text1 = string.Format("15");
            string text2 = string.Format("25");
            string text3 = string.Format("40");
            string swaveNumber = string.Format("Round: {0}/{1}", waveNumber, totalWaveNumber - 1);
            spriteBatch.DrawString(font, text, textPosition + new Vector2(160, -25), Color.Black);
            spriteBatch.DrawString(font, help, textPosition + new Vector2(160, -10), Color.Black);
            spriteBatch.DrawString(font, text1, new Vector2(47, 610), Color.Black);
            spriteBatch.DrawString(font, text1, new Vector2(111, 610), Color.Black);
            spriteBatch.DrawString(font, text1, new Vector2(175, 610), Color.Black);
            spriteBatch.DrawString(font, text1, new Vector2(239, 610), Color.Black);
            spriteBatch.DrawString(font, text2, new Vector2(303, 610), Color.Black);
            spriteBatch.DrawString(font, text3, new Vector2(368, 610), Color.Black);
            spriteBatch.DrawString(font, swaveNumber, textPosition, Color.Black);
        }
        public StudentWaweManager(Player player, Map map, int numberOfWaves, Texture2D[] studentTextureArray)
        {
            this.numberOfWaves = numberOfWaves;
            this.studentTextureArray = studentTextureArray;

            this.map = map;
            soundFlag = true;

            for (int i = 0; i < numberOfWaves; i++)
            {
                int initialNumerOfStudents = 10;
                int numberModifier = 2*(i / 10) + 1;

                // Pass the reference to the player, to the wave class.
                Wave wave = new Wave(i, initialNumerOfStudents * 
                    numberModifier, player, map, studentTextureArray);

                waves.Enqueue(wave);
            }

            StartNextWave();
        }
Exemple #4
0
        protected override void LoadContent()
        {
            /*Load the pictures, videos, audioes needed and initialize them*/
            spriteBatch = new SpriteBatch(GraphicsDevice);
    
            Texture2D gameover = Content.Load<Texture2D>("Movies\\gameover");
            gameoverScreen = new Sprite(gameover, new Vector2(200, 0));
            Texture2D gamewin = Content.Load<Texture2D>("Movies\\gamewin");
            gamewinScreen = new Sprite(gamewin, new Vector2(200, 0));
            Texture2D[] helpTextureArray;
            helpTextureArray = new Texture2D[]
            {
                 Content.Load<Texture2D>("help\\help1"),
                 Content.Load<Texture2D>("help\\help2"),
                 Content.Load<Texture2D>("help\\help3"),
            };
            helpSprite1 = new Sprite(helpTextureArray[0], new Vector2(0, 0));
            helpSprite2 = new Sprite(helpTextureArray[1], new Vector2(0, 0));
            helpSprite3 = new Sprite(helpTextureArray[2], new Vector2(0, 0));
            Texture2D newGamePic = Content.Load<Texture2D>("GUI\\newGame");
            newGameButton = new Button(newGamePic, newGamePic, newGamePic,
              new Vector2(700, map.Height * 47));
            Texture2D exitGamePic = Content.Load<Texture2D>("GUI\\exit");
            exitButton = new Button(exitGamePic, exitGamePic, exitGamePic,
                new Vector2(700, map.Height * 60));
            Texture2D creditPic = Content.Load<Texture2D>("GUI\\credits");
            creditVideo = new Button(creditPic, creditPic, creditPic,
                new Vector2(700, (float)(map.Height * 53.5)));

            video = Content.Load<Video>("movies\\video");
            videoPlayer = new VideoPlayer();
            video2 = Content.Load<Video>("movies\\creditVideo");
            videoPlayer2 = new VideoPlayer();

            bgMusic = Content.Load<SoundEffect>("Audio\\background");
            bgMusicInstance = bgMusic.CreateInstance();
            bgMusicInstance.IsLooped = true;
            setSound = Content.Load<SoundEffect>("Audio\\set");
            spawnSound = Content.Load<SoundEffect>("Audio\\spawn");
          
            Texture2D topBar = Content.Load<Texture2D>("GUI\\tool bar");
            SpriteFont font = Content.Load<SpriteFont>("Arial");

            toolBar = new Toolbar(topBar, font, new Vector2(0, 165));

            Texture2D graph = Content.Load<Texture2D>("map");

            map.AddTexture(graph); 

            Texture2D paperTexture = Content.Load<Texture2D>("paper");
            Texture2D paperBreakTexture = Content.Load<Texture2D>("paperbreak");

            Texture2D[] teacherTextures = new Texture2D[]
            {
                Content.Load<Texture2D>("Teachers\\t1teacher"),
                Content.Load<Texture2D>("Teachers\\t2teacher"),
                Content.Load<Texture2D>("Teachers\\t3teacher"),
                Content.Load<Texture2D>("Teachers\\t4teacher"),
                Content.Load<Texture2D>("Teachers\\t5teacher"),
                Content.Load<Texture2D>("Teachers\\t6teacher"),
            };

            player = new Player(map, teacherTextures, paperTexture, paperBreakTexture);

            Texture2D[] StudentTextureArray = new Texture2D[]
            {
                 Content.Load<Texture2D>("Students\\student1"),
                 Content.Load<Texture2D>("Students\\student2"),
                 Content.Load<Texture2D>("Students\\student3"),
                 Content.Load<Texture2D>("Students\\student4"),
            };
            
            studentWaweManager = new StudentWaweManager(player, map, 10, StudentTextureArray);

            t1Button = new Button(teacherTextures[0], teacherTextures[0],
                teacherTextures[0], new Vector2(5, map.Height * 60-5), 6);
            t2Button = new Button(teacherTextures[1], teacherTextures[1],
                teacherTextures[1], new Vector2(65, map.Height * 60), 7);
            t3Button = new Button(teacherTextures[2], teacherTextures[2],
                teacherTextures[2], new Vector2(60 * 2+15, map.Height * 60), 6);
            t4Button = new Button(teacherTextures[3], teacherTextures[3],
                teacherTextures[3], new Vector2(60*3+15, map.Height * 60), 5);
            t5Button = new Button(teacherTextures[4], teacherTextures[4],
                teacherTextures[4], new Vector2(60 * 4+20, map.Height * 60), 6);
            t6Button = new Button(teacherTextures[5], teacherTextures[5],
                teacherTextures[5], new Vector2(60 * 5+23, map.Height * 60), 7);

    

            t1Button.OnPress += new EventHandler(t1Button_OnPress);
            t2Button.OnPress += new EventHandler(t2Button_OnPress);
            t3Button.OnPress += new EventHandler(t3Button_OnPress);
            t4Button.OnPress += new EventHandler(t4Button_OnPress);
            t5Button.OnPress += new EventHandler(t5Button_OnPress);
            t6Button.OnPress += new EventHandler(t6Button_OnPress);
        }