예제 #1
0
        /// <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);
            mainMenuButtons    = new Texture2D[3];
            Map.map            = Map.Parse("1.txt");
            debugFont          = Content.Load <SpriteFont>("SpriteFont1");
            cam                = new Camera();
            mainMenuButtons[0] = Content.Load <Texture2D>("PlayButton");
            mainMenuButtons[1] = Content.Load <Texture2D>("OptsButton");

            cellT = Content.Load <Texture2D>("Cell");

            font = Content.Load <SpriteFont>("SpriteFont1");

            towersText    = new Texture2D[10];
            towersText[0] = Content.Load <Texture2D>("Tower");

            uiTextures    = new Texture2D[10];
            uiTextures[0] = Content.Load <Texture2D>("planUI");

            clippedToMouse = new Tower(Point.Zero, Tower.Types.type1, towersText[0]);

            currentMenu = new Menus.MainMenu();
            gameUi      = new InGameUI(uiTextures);
            ingamemenu  = new Menus.InGameMenu(ref cam, "1.txt");
        }
예제 #2
0
        /// <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);
            mainMenuButtons    = new Texture2D[3];
            map                = Cell.Parse("1.txt");
            cam                = new Camera(map);
            mainMenuButtons[0] = Content.Load <Texture2D>("PlayButton");
            mainMenuButtons[1] = Content.Load <Texture2D>("OptsButton");

            cellT = Content.Load <Texture2D>("Cell");

            font = Content.Load <SpriteFont>("SpriteFont1");

            towersText    = new Texture2D[10];
            towersText[0] = Content.Load <Texture2D>("Tower");

            uiTextures    = new Texture2D[10];
            uiTextures[0] = Content.Load <Texture2D>("planUI");
            mainMenu      = new IMenu(GameState.MainMenu);
            mainMenu.AddButton("Play", font, mainMenuButtons[0], GameState.LoadingMenu);
            mainMenu.AddButton("Options", font, mainMenuButtons[1], GameState.Options);
            mainMenu.AddButton("Quit", font, mainMenuButtons[0], GameState.Quit, Color.Yellow);

            inGameMenu = new IMenu(GameState.InGameMenu);
            inGameMenu.AddButton("Play", font, mainMenuButtons[0], GameState.InGame);
            inGameMenu.AddButton("Main Menu", font, mainMenuButtons[1], GameState.MainMenu);

            clippedToMouse = new Tower(Point.Zero, Tower.Types.type1, towersText[0]);

            currentMenu = mainMenu;
            gameUi      = new InGameUI(uiTextures);
        }
예제 #3
0
        public void Update(MouseHandler mouse, GameTime gametime, InGameUI uI)
        {
            if (mouse.position.X > maxX)
                position.X += (float)(speed * gametime.ElapsedGameTime.TotalSeconds);

            else if (mouse.position.X < minX)
                position.X -= (float)(speed * gametime.ElapsedGameTime.TotalSeconds);

            if (mouse.position.Y > maxY)
                position.Y += (float)(speed * gametime.ElapsedGameTime.TotalSeconds);

            else if (mouse.position.Y < minY)
                position.Y -= (float)(speed * gametime.ElapsedGameTime.TotalSeconds);

            if (position.X + GraphicsDeviceManager.DefaultBackBufferWidth >= mapWidth)
                position.X = mapWidth - GraphicsDeviceManager.DefaultBackBufferWidth;

            else if (position.X < 0)
                position.X = 0;

            if (position.Y + (GraphicsDeviceManager.DefaultBackBufferHeight - uI.textBounds[0].Height) >= mapHeight)
                position.Y = mapHeight - (GraphicsDeviceManager.DefaultBackBufferHeight - uI.textBounds[0].Height);

            else if (position.Y < 0)
                position.Y = 0;

            viewMatrix = Matrix.CreateTranslation(new Vector3(-position, 0));
        }
예제 #4
0
        /// <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.
            Map.map         = Map.Parse(currentMap);
            cellsWithTower  = new List <Cell>();
            spriteBatch     = new SpriteBatch(GraphicsDevice);
            mainMenuButtons = new Texture2D[3];
            towersText      = new Texture2D[10];
            uiTextures      = new Texture2D[10];

            cam          = new Camera();
            cam.position = new Vector2(0, Map.initialPathLocation.Y - GraphicsDeviceManager.DefaultBackBufferHeight / 2);

            debugFont = Content.Load <SpriteFont>("SpriteFont1");
            font      = Content.Load <SpriteFont>("SpriteFont1");

            creepText = Content.Load <Texture2D>("Creep");

            wave = new CreepWave(30);

            towerRange = Content.Load <Texture2D>("range");

            missileText = Content.Load <Texture2D>("Missile");

            mainMenuButtons[0] = Content.Load <Texture2D>("PlayButton");
            mainMenuButtons[1] = Content.Load <Texture2D>("OptsButton");

            cellT = Content.Load <Texture2D>("Cell");

            towersText[0] = Content.Load <Texture2D>("Tower");

            uiTextures[0] = Content.Load <Texture2D>("UIParts/UI_Bottom");
            uiTextures[1] = Content.Load <Texture2D>("Icons/deleteIcon");
            uiTextures[2] = Content.Load <Texture2D>("Icons/addIcon");
            uiTextures[3] = Content.Load <Texture2D>("Icons/upgradeIcon");

            currentMenu  = new Menus.MainMenu();
            options      = new Menus.Options(graphics);
            gameUi       = new InGameUI(uiTextures, ref cellsWithTower);
            ingamemenu   = new Menus.InGameMenu(ref cam, ref cellsWithTower, currentMap);
            gameOverMenu = new Menus.GameOverMenu(ref cam, ref cellsWithTower, currentMap);

            clippedToMouse = new Tower(Point.Zero, Tower.Types.type1, towersText[0], 100, false);
        }
예제 #5
0
        public void Update(MouseHandler mouse, GameTime gametime, InGameUI uI)
        {
            if (mouse.position.X > maxX)
            {
                position.X += (float)(speed * gametime.ElapsedGameTime.TotalSeconds);
            }

            else if (mouse.position.X < minX)
            {
                position.X -= (float)(speed * gametime.ElapsedGameTime.TotalSeconds);
            }

            if (mouse.position.Y > maxY)
            {
                position.Y += (float)(speed * gametime.ElapsedGameTime.TotalSeconds);
            }

            else if (mouse.position.Y < minY)
            {
                position.Y -= (float)(speed * gametime.ElapsedGameTime.TotalSeconds);
            }

            if (position.X + GraphicsDeviceManager.DefaultBackBufferWidth >= mapWidth)
            {
                position.X = mapWidth - GraphicsDeviceManager.DefaultBackBufferWidth;
            }

            else if (position.X < 0)
            {
                position.X = 0;
            }

            if (position.Y + (GraphicsDeviceManager.DefaultBackBufferHeight - uI.textBounds[0].Height) >= mapHeight)
            {
                position.Y = mapHeight - (GraphicsDeviceManager.DefaultBackBufferHeight - uI.textBounds[0].Height);
            }

            else if (position.Y < 0)
            {
                position.Y = 0;
            }

            viewMatrix = Matrix.CreateTranslation(new Vector3(-position, 0));
        }
예제 #6
0
        /// <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);
            mainMenuButtons = new Texture2D[3];
            Map.map = Map.Parse("1.txt");
            debugFont = Content.Load<SpriteFont>("SpriteFont1");
            cam = new Camera();
            mainMenuButtons[0] = Content.Load<Texture2D>("PlayButton");
            mainMenuButtons[1] = Content.Load<Texture2D>("OptsButton");

            cellT = Content.Load<Texture2D>("Cell");

            font = Content.Load<SpriteFont>("SpriteFont1");

            towersText = new Texture2D[10];
            towersText[0] = Content.Load<Texture2D>("Tower");

            uiTextures = new Texture2D[10];
            uiTextures[0] = Content.Load<Texture2D>("planUI");

            clippedToMouse = new Tower(Point.Zero, Tower.Types.type1, towersText[0]);

            currentMenu = new Menus.MainMenu();
            gameUi = new InGameUI(uiTextures);
            ingamemenu = new Menus.InGameMenu(ref cam, "1.txt");
        }
예제 #7
0
        /// <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);
            mainMenuButtons = new Texture2D[3];
            map = Cell.Parse("1.txt");
            cam = new Camera(map);
            mainMenuButtons[0] = Content.Load<Texture2D>("PlayButton");
            mainMenuButtons[1] = Content.Load<Texture2D>("OptsButton");

            cellT = Content.Load<Texture2D>("Cell");

            font = Content.Load<SpriteFont>("SpriteFont1");

            towersText = new Texture2D[10];
            towersText[0] = Content.Load<Texture2D>("Tower");

            uiTextures = new Texture2D[10];
            uiTextures[0] = Content.Load<Texture2D>("planUI");
            mainMenu = new IMenu(GameState.MainMenu);
            mainMenu.AddButton("Play", font, mainMenuButtons[0], GameState.LoadingMenu);
            mainMenu.AddButton("Options", font, mainMenuButtons[1], GameState.Options);
            mainMenu.AddButton("Quit", font, mainMenuButtons[0], GameState.Quit, Color.Yellow);

            inGameMenu = new IMenu(GameState.InGameMenu);
            inGameMenu.AddButton("Play", font, mainMenuButtons[0], GameState.InGame);
            inGameMenu.AddButton("Main Menu", font, mainMenuButtons[1], GameState.MainMenu);

            clippedToMouse = new Tower(Point.Zero, Tower.Types.type1, towersText[0]);

            currentMenu = mainMenu;
            gameUi = new InGameUI(uiTextures);
        }
예제 #8
0
        /// <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.
            Map.map = Map.Parse(currentMap);
            cellsWithTower = new List<Cell>();
            spriteBatch = new SpriteBatch(GraphicsDevice);
            mainMenuButtons = new Texture2D[3];
            towersText = new Texture2D[10];
            uiTextures = new Texture2D[10];

            cam = new Camera();
            cam.position = new Vector2(0, Map.initialPathLocation.Y - GraphicsDeviceManager.DefaultBackBufferHeight / 2);

            debugFont = Content.Load<SpriteFont>("SpriteFont1");
            font = Content.Load<SpriteFont>("SpriteFont1");

            creepText = Content.Load<Texture2D>("Creep");

            wave = new CreepWave(30);

            towerRange = Content.Load<Texture2D>("range");

            missileText = Content.Load<Texture2D>("Missile");

            mainMenuButtons[0] = Content.Load<Texture2D>("PlayButton");
            mainMenuButtons[1] = Content.Load<Texture2D>("OptsButton");

            cellT = Content.Load<Texture2D>("Cell");

            towersText[0] = Content.Load<Texture2D>("Tower");

            uiTextures[0] = Content.Load<Texture2D>("UIParts/UI_Bottom");
            uiTextures[1] = Content.Load<Texture2D>("Icons/deleteIcon");
            uiTextures[2] = Content.Load<Texture2D>("Icons/addIcon");
            uiTextures[3] = Content.Load<Texture2D>("Icons/upgradeIcon");

            currentMenu = new Menus.MainMenu();
            options = new Menus.Options(graphics);
            gameUi = new InGameUI(uiTextures, ref cellsWithTower);
            ingamemenu = new Menus.InGameMenu(ref cam, ref cellsWithTower, currentMap);
            gameOverMenu = new Menus.GameOverMenu(ref cam, ref cellsWithTower, currentMap);

            clippedToMouse = new Tower(Point.Zero, Tower.Types.type1, towersText[0], 100, false);
        }