public WaveManager(Map map, int numberOfWave, float timeBetweenWaves, int[] numberofdot, int[] timebetweendot, int[] numberOfEnemy, float[] timeEnemyAppear)
        {
            _waves = new Queue<Wave>();
            _numberOfWave = numberOfWave;
            _map = map;
            _timeBetweenWaves = timeBetweenWaves;
            _numberOfDot = numberofdot;
            _timeBetweenDot = timebetweendot;
            _numberOfEnemy = numberOfEnemy;
            _timeEnemyAppear = timeEnemyAppear;

            _toolbarfont = FontManager.getFont(0);
            _wavefont = FontManager.getFont(1);

            Texture2D texture = Global.CONTENT.Load<Texture2D>(@"Sprite\Image\Menu\button_skip");
            NormalSprite skip = new NormalSprite(texture, 750, 55, texture.Width / 2, texture.Height / 2);
            button_skip = new MenuButton(skip, 2, 1, 0, 0);

            for (int i = 0; i < _numberOfWave; i++)
            {
                Wave wave = new Wave(i, _numberOfDot[i], _timeBetweenDot[i], _numberOfEnemy[i], _timeEnemyAppear[i], _map);
                _waves.Enqueue(wave);
            }

            StartNextWave();
        }
        private void SetUpPanel(ContentManager Content)
        {
            menuButtonList = new List<MenuButton>();

            #region Panel
            Texture2D texture_lose = Content.Load<Texture2D>(@"Sprite\Image\Menu\panel_lose");
            panel_lose = new NormalSprite(texture_lose, 250, 150, texture_lose.Width, texture_lose.Height);
            Texture2D texture_win = Content.Load<Texture2D>(@"Sprite\Image\Menu\panel_win");
            panel_win = new NormalSprite(texture_win, 250, 150, texture_win.Width, texture_win.Height);
            #endregion
            float x = panel_lose.Left + panel_lose.Texture.Width / 3;
            float y = panel_lose.Top + panel_lose.Texture.Height / 2;

            #region Button menu in panel ID = 1
            Texture2D button_menu_texture = Content.Load<Texture2D>(@"Sprite\Image\Menu\button_menu");
            NormalSprite button_menu = new NormalSprite(button_menu_texture, x - button_menu_texture.Width / 4 + panel_lose.Texture.Width / 3, y, button_menu_texture.Width / 2, button_menu_texture.Height);
            menu = new MenuButton(button_menu, 2, 1, 0, 0);
            menuButtonList.Add(menu);
            #endregion

            #region Button replay in panel ID = 2
            Texture2D button_replay_texture = Content.Load<Texture2D>(@"Sprite\Image\Menu\button_replay");
            NormalSprite button_replay = new NormalSprite(button_replay_texture, x - button_replay_texture.Width / 4, y, button_replay_texture.Width / 2, button_replay_texture.Height);
            replay = new MenuButton(button_replay, 2, 2, 0, 0);
            menuButtonList.Add(replay);
            #endregion

            #region Button play in panel ID = 3
            Texture2D button_play_texture = Content.Load<Texture2D>(@"Sprite\Image\Menu\button_play");
            NormalSprite button_play = new NormalSprite(button_play_texture, x - button_play_texture.Width / 4, y, button_play_texture.Width / 2, button_play_texture.Height);
            play = new MenuButton(button_play, 2, 3, 0, 0);
            menuButtonList.Add(play);
            #endregion
        }
Exemple #3
0
        public static List<MenuButton> loadTowerButton(ContentManager Content)
        {
            List<MenuButton> list = new List<MenuButton>();

            XmlDocument doc = new XmlDocument();
            doc.Load(@"Data/tower.dat");

            XmlNodeList towerButtons = doc.SelectNodes("//tower-button");

            for (int i = 0; i < towerButtons.Count; i++)
            {
                if (int.Parse(towerButtons[i].Attributes[0].Value) <= Global.LEVEL)
                {
                    Texture2D texture = Content.Load<Texture2D>(towerButtons[i].InnerText);
                    NormalSprite sprite = new NormalSprite(texture, 34 + i * 67, 510, texture.Width / 2, texture.Height);
                    MenuButton button = new MenuButton(sprite, 2, i, 0, 0);

                    list.Add(button);
                }
            }

            return list;
        }
Exemple #4
0
        private void createQuitScreen()
        {
            Texture2D panel = Content.Load<Texture2D>(@"Sprite\Image\Menu\quit");
            quitPanel = new NormalSprite(panel, 200, (Global.GAME_HEIGHT - panel.Height)/2, panel.Width, panel.Height);

            Texture2D yes_tex = Content.Load<Texture2D>(@"Sprite\Image\Menu\yes");
            NormalSprite yes = new NormalSprite(yes_tex, (Global.GAME_WIDTH - yes_tex.Width) / 2 - 5, Global.GAME_HEIGHT / 2, yes_tex.Width / 2, yes_tex.Height);
            btn_yes = new MenuButton(yes, 2, 1, 0, 0);

            Texture2D no_tex = Content.Load<Texture2D>(@"Sprite\Image\Menu\no");
            NormalSprite no = new NormalSprite(no_tex, Global.GAME_WIDTH / 2 + 5, Global.GAME_HEIGHT / 2, no_tex.Width / 2, no_tex.Height);
            btn_no = new MenuButton(no, 2, 2, 0, 0);
        }
Exemple #5
0
 private void createPausePanel()
 {
     createOptionScreen(@"Sprite\Image\Menu\pause_panel");
     Texture2D menuButton_tex = Content.Load<Texture2D>(@"Sprite\Image\Menu\menu");
     NormalSprite menuButton = new NormalSprite(menuButton_tex, 340, 375, menuButton_tex.Width / 2, menuButton_tex.Height);
     button_menu = new MenuButton(menuButton, 2, 4, 0, 0);
 }
Exemple #6
0
        private void createOptionScreen(string panel_file)
        {
            Data.loadConfig();
            Texture2D texture = Content.Load<Texture2D>(panel_file);
            _optionPanel = new NormalSprite(texture, 250, 150, texture.Width, texture.Height);

            Texture2D checkbox_tex = Content.Load<Texture2D>(@"Sprite\Image\Menu\checkbox");

            NormalSprite checkbox_sound = new NormalSprite(checkbox_tex, 458, 230, checkbox_tex.Width / 2, checkbox_tex.Height);
            button_sound = new Checkbox(checkbox_sound, 2, Global.SOUNDEFFECT_ENABLE);

            NormalSprite checkbox_music = new NormalSprite(checkbox_tex, 458, 270, checkbox_tex.Width / 2, checkbox_tex.Height);
            button_music = new Checkbox(checkbox_music, 2, Global.MUSIC_ENABLE);

            Texture2D okButton_tex = Content.Load<Texture2D>(@"Sprite\Image\Menu\ok");
            NormalSprite okButton = new NormalSprite(okButton_tex, 340, 325, okButton_tex.Width / 2, okButton_tex.Height);
            button_ok = new MenuButton(okButton, 2, 3, 0, 0);
        }
Exemple #7
0
        private void createAboutScreen()
        {
            Texture2D panel = Content.Load<Texture2D>(@"Sprite\Image\Menu\about");
            aboutPanel = new NormalSprite(panel, 250, 150, panel.Width, panel.Height);

            Texture2D close_tex = Content.Load<Texture2D>(@"Sprite\Image\Menu\ok");
            NormalSprite close = new NormalSprite(close_tex, (Global.GAME_WIDTH - close_tex.Width / 2) / 2, 300, close_tex.Width / 2, close_tex.Height);
            btn_close = new MenuButton(close, 2, 1, 0, 0);
        }
Exemple #8
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            #region Khởi tạo Resolution của game và độ rộng của 1 ô
            Global.GAME_WIDTH = GraphicsDevice.Viewport.Bounds.Width;
            Global.GAME_HEIGHT = GraphicsDevice.Viewport.Bounds.Height;
            Global.CELL_WIDTH = 50;
            Global.CELL_HEIGHT = 50;
            #endregion

            #region Khởi tạo giá trị HEALTH của người chơi, Game speed
            Global.HEALTH = 100;
            Global.GAME_SPEED = 1;
            Global.NEW_GAME_SPEED = 1;
            Global.OLD_GAME_SPEED = Global.NEW_GAME_SPEED;
            Global.CONTENT = Content;
            #endregion

            #region Khởi tạo background và logo
            _backgroundSprite = new Background(@"Sprite\Image\background", Content, 2, 0.1f);
            _logoTexture = this.Content.Load<Texture2D>(@"Sprite\Image\logo");
            _logoSprite = new NormalSprite(_logoTexture, (GraphicsDevice.Viewport.Width - _logoTexture.Width) / 2, 35, _logoTexture.Width, _logoTexture.Height, 1);

            //Animation đốm lửa sau logo
            _backgroundAnimatedTexture = this.Content.Load<Texture2D>(@"Sprite\Image\backgroundAnimation");
            _backgroundAnimatedSprite = new AnimatedSprite(_backgroundAnimatedTexture, (GraphicsDevice.Viewport.Width - _logoTexture.Width) / 2, 0, _backgroundAnimatedTexture.Width, _backgroundAnimatedTexture.Height, 65, 6, 8);
            #endregion

            #region Khởi tạo menu game
            _menuBackgroundTexture = this.Content.Load<Texture2D>(@"Sprite\Image\Menu\menuBackground");
            _mainMenu = new Menu();
            for (int i = 0; i < _nButton; i++)
            {
                _menuButtonTexture = this.Content.Load<Texture2D>(@"Sprite\Image\Menu\Button" + (i + 1));
                NormalSprite _menuButtonSprite = new NormalSprite(_menuButtonTexture, GraphicsDevice.Viewport.Width / 20, (i + 3) * GraphicsDevice.Viewport.Height / 9, GraphicsDevice.Viewport.Width / 6, _menuButtonTexture.Height);
                MenuButton _button = new MenuButton(_menuButtonSprite, 2, i + 1, 2, 0.5f);
                _mainMenu.Buttons.Add(_button);
            }
            #endregion

            #region Khởi tạo âm thanh
            SoundManager.Init(Content);
            Data.loadConfig();
            #endregion

            createMenuScreen();
        }