Ejemplo n.º 1
0
        internal static void addRoom(UpgradeMenu.ButtonRoom buttonRoom)
        {
            var cbutton = new Button(buttonRoom.r.img, 30, 50 + 60 * boughtRooms.Count, 100, 50);

            cbutton.text.font     = Text.fonts["RetroComputer-12"];
            cbutton.text.position = new Vector2(140, 50 + 10 + 60 * boughtRooms.Count);
            var croom = new Room(buttonRoom.r.name, buttonRoom.r.cost, buttonRoom.r.level, buttonRoom.r.type, buttonRoom.r.description, buttonRoom.r.activate, buttonRoom.r.img);
            var copy  = new UpgradeMenu.ButtonRoom(cbutton, croom);

            boughtRooms.Add(copy);
        }
Ejemplo n.º 2
0
        //Took out the parameters on these next two functions as
        //they are likely going to want to hit every room in the lair?
        public static void loadContent(ContentManager content)
        {
            selectedRoomSwapButton = new UpgradeMenu.ButtonRoom();
            EndOfGame          = false;
            TowerLevel         = 0;
            MaxLevel           = 3;
            TutorialText       = new Text("", new Vector2(200, 25), Text.fonts["6809Chargen-24"], Color.DarkGreen);
            highlighter        = content.Load <Texture2D>("Highlight");
            highlighter_rect   = new Rectangle();
            InfoText           = new Text("", new Vector2(LeaveMeAlone.WindowX - 350, LeaveMeAlone.WindowY - 200), Text.fonts["6809Chargen-24"], Color.Black);
            towerPosition      = new Vector2(0, 0);
            LairRooms          = new List <Room>();
            skillsBtn          = new Button(content.Load <Texture2D>("skillsBtn"), LeaveMeAlone.WindowX - 200, 100, 200, 75);
            constructionBtn    = new Button(content.Load <Texture2D>("constructionBtn"), LeaveMeAlone.WindowX - 200, 180, 200, 75);
            nextwaveBtn        = new Button(content.Load <Texture2D>("nextwaveBtn"), LeaveMeAlone.BackgroundRect.X, LeaveMeAlone.BackgroundRect.Height - 75, 200, 75);
            grindwaveBtn       = new Button(content.Load <Texture2D>("Buttons/GrindBtn"), LeaveMeAlone.BackgroundRect.X, LeaveMeAlone.BackgroundRect.Height - 75, 200, 75);
            mainmenuBtn        = new Button(content.Load <Texture2D>("Buttons/MainMenu"), LeaveMeAlone.WindowX - 300, 0, 300, 80);
            lairBkgd           = content.Load <Texture2D>("lairBkgd");
            lairLobby          = content.Load <Texture2D>("lairLobby");
            bossRoom           = content.Load <Texture2D>("bossRoom");
            unconstructed_room = content.Load <Texture2D>("unconstructed_room");
            UnconstructedRoom  = new Room("Unconstructed Room", 0, 0, 0, "A new blank space to construct a room.", null, unconstructed_room);

            //Testing rooms
            //UpgradeMenu.boughtRooms.Add(SkillTree.papparazzi);


            /*
             * This can be used to debug rooms
             *
             *             int index = 0;
             *
             * foreach (Room r in UpgradeMenu.boughtRooms)
             * {
             *
             *  index++;
             *  //Console.WriteLine(r.name);
             * }
             */
        }
Ejemplo n.º 3
0
        public static LeaveMeAlone.GameState Update(GameTime gameTime)
        {
            lastMouseState    = currentMouseState;
            currentMouseState = Mouse.GetState();

            if (BattleManager.boss.level < 2)
            {
                HandleTutorial();
            }

            if (lastMouseState.LeftButton == ButtonState.Pressed && currentMouseState.LeftButton == ButtonState.Released)
            {
                for (int i = 0; i < TowerLevel; i++)
                {
                    var rectpos = new Rectangle((int)(towerPosition.X + LeaveMeAlone.WindowX / 3), (int)(towerPosition.Y + LeaveMeAlone.WindowY - 100 - 100 * (i + 1)), 400, 100);
                    if (selectedRoomSwapButton.r != null && LairRooms.Contains(selectedRoomSwapButton.r) == false && rectpos.Contains(currentMouseState.X, currentMouseState.Y))
                    {
                        foreach (UpgradeMenu.ButtonRoom oldroom in boughtRooms)
                        {
                            if (oldroom.r == LairRooms[i])
                            {
                                oldroom.used = false;
                            }
                        }
                        LairRooms[i] = selectedRoomSwapButton.r;
                        selectedRoomSwapButton.used = true;
                        tutorial_state = TutorialState.SendWave;
                    }
                }
                if ((EndOfGame && grindwaveBtn.Intersects(currentMouseState.X, currentMouseState.Y)))
                {
                    BattleManager.Init();
                    List <Character> newParty = PartyManager.CreateParty();
                    BattleManager.heroes = newParty;
                    return(LeaveMeAlone.GameState.Battle);
                }
                //next wave
                if (nextwaveBtn.Intersects(currentMouseState.X, currentMouseState.Y))
                {
                    BossBattle = false;
                    if (EndOfGame)
                    {
                        InfoText.changeMessage("PEASANTS!\nOUT OF THE WAY!\nHE'S OURS");
                        //create the last party
                        if (one_last_party)
                        {
                            for (int i = 0; i <= PartyManager.partyQueue.Count(); i++)
                            {
                                PartyManager.partyQueue.Add(null);
                                PartyManager.popParty();
                            }
                            List <Character> FinalParty = new List <Character>();

                            FinalParty.Add(new Character(Character.Type.Knight, 14, new Vector2(sideOffset + sideScaling, topOffset)));
                            FinalParty.Add(new Character(Character.Type.Ranger, 14, new Vector2(sideOffset, topOffset + topScaling * 1)));
                            FinalParty.Add(new Character(Character.Type.Mage, 14, new Vector2(sideOffset + sideScaling, topOffset + topScaling * 2)));
                            FinalParty.Add(new Character(Character.Type.Mage, 14, new Vector2(sideOffset, topOffset + topScaling * 3)));
                            PartyManager.partyQueue.Add(FinalParty);
                            PartyManager.popParty();
                            one_last_party = false;
                        }
                        //push nothing else
                        else
                        {
                            if (PartyManager.popParty())
                            {
                                BattleManager.Init();
                                //Re-Add the party in case the player loses
                                List <Character> FinalParty = new List <Character>();
                                FinalParty.Add(new Character(Character.Type.Knight, 14, new Vector2(sideOffset + sideScaling, topOffset)));
                                FinalParty.Add(new Character(Character.Type.Ranger, 14, new Vector2(sideOffset, topOffset + topScaling * 1)));
                                FinalParty.Add(new Character(Character.Type.Mage, 14, new Vector2(sideOffset + sideScaling, topOffset + topScaling * 2)));
                                FinalParty.Add(new Character(Character.Type.Mage, 14, new Vector2(sideOffset, topOffset + topScaling * 3)));
                                PartyManager.partyQueue.Add(FinalParty);
                                BossBattle = true;
                                return(LeaveMeAlone.GameState.Battle);
                            }
                            else
                            {
                                PartyManager.partyQueue.Add(null);
                                return(LeaveMeAlone.GameState.Lair);
                            }
                        }
                    }
                    //Normally push a party
                    else
                    {
                        for (int i = 0; i < TowerLevel; i++)
                        {
                            LairAttack(LairRooms[i], PartyManager.partyQueue[i]);
                        }
                        Random random    = new Random();
                        int    makeParty = 0;//random.Next(100) % 4;
                        if (makeParty != 1)
                        {
                            List <Character> newParty = PartyManager.CreateParty();
                            PartyManager.partyQueue.Add(newParty);
                        }
                        else
                        {
                            PartyManager.partyQueue.Add(null);
                        }
                        if (PartyManager.popParty())
                        {
                            BattleManager.Init();
                            InfoText.changeMessage("");
                            return(LeaveMeAlone.GameState.Battle);
                        }
                        else
                        {
                            //Should have some sort of interface on screen
                            InfoText.changeMessage("Here they come\n      I can feel them.");
                            return(LeaveMeAlone.GameState.Lair);
                        }
                    }
                }
                if (skillsBtn.Intersects(currentMouseState.X, currentMouseState.Y))
                {
                    return(LeaveMeAlone.GameState.Upgrade);
                }
                if (constructionBtn.Intersects(currentMouseState.X, currentMouseState.Y))
                {
                    if (TowerLevel < MaxLevel)
                    {
                        TowerLevel++;
                        LairRooms.Add(UnconstructedRoom);
                        PartyManager.partyQueue.Add(null);
                        for (int j = PartyManager.partyQueue.Count() - 1; j > 0; j--)
                        {
                            PartyManager.partyQueue[j] = PartyManager.partyQueue[j - 1];
                        }
                        PartyManager.partyQueue[0] = null;
                    }
                    else
                    {
                        InfoText.changeMessage("Max Lair Height");
                        texttimer = 600;
                    }
                    tutorial_state = TutorialState.Build2;
                    return(LeaveMeAlone.GameState.Lair);
                }
                if (mainmenuBtn.Intersects(currentMouseState.X, currentMouseState.Y))
                {
                    MainMenu.init(false);
                    LeaveMeAlone.Menu_Song_Instance.Stop();
                    //UpgradeMenu.boughtRooms.Clear();
                    return(LeaveMeAlone.GameState.Main);
                }
                //checks if a room button was selected
                selected_flag = false;
                foreach (UpgradeMenu.ButtonRoom r in boughtRooms)
                {
                    if (r.b.Intersects(currentMouseState.X, currentMouseState.Y) && !r.used)
                    {
                        Console.WriteLine(r.b.text);
                        //already have a selected thing;
                        if (selectedRoomSwapButton.b != null)
                        {
                            selectedRoomSwapButton.b.selected = false;
                        }
                        selectedRoomSwapButton = r;
                        r.b.selected           = true;
                        selected_flag          = true;
                        tutorial_state         = TutorialState.Build3;
                    }
                }
                //otherwise we unselect any previously selected button
                if (selected_flag == false && selectedRoomSwapButton.b != null)
                {
                    selectedRoomSwapButton.b.selected = false;
                    selectedRoomSwapButton            = new UpgradeMenu.ButtonRoom();
                }
            }

            return(LeaveMeAlone.GameState.Lair);
        }