Ejemplo n.º 1
0
 public Recipe(Combinator.Runes _rune1, Combinator.Runes _rune2, Combinator.Runes _rune3, Combinator.TowerType _tower)
 {
     rune1 = _rune1;
     rune2 = _rune2;
     rune3 = _rune3;
     towerType = _tower;
 }
Ejemplo n.º 2
0
        public void UpdateInterface(GameTime gameTime, Rectangle mouseRec, MouseState previousState)
        {
            #region UpdateMainRunes
            for (int i = 0; i < 10; i++)
            {
                if (mouseRec.Intersects(runeRectangles[i]))
                {
                    if ((Mouse.GetState().LeftButton == ButtonState.Pressed) && (previousState.LeftButton == ButtonState.Released))
                    {

                        if (RuneManager.RuneBag[i] >= 1)
                        {
                            combinatorRunes[runeCount] = RuneManager.RuneList[i];
                            combinatorRuneText[runeCount] = runes[i];
                            runeCount++;
                            RuneManager.RemoveRune(i, 1);

                        }

                        if( runeCount == 3)
                        {
                             runeCount = 0;
                             currentTower = (combinator.parseCombination(combinatorRunes[0], combinatorRunes[1], combinatorRunes[2]));
                             if (currentTower != Combinator.TowerType.INVALID) altMouseTex = recipes[i];

                             if (currentTower == Combinator.TowerType.INVALID)
                             {
                                 RuneManager.AddExistingRune(combinatorRunes[0]);
                                 RuneManager.AddExistingRune(combinatorRunes[1]);
                                 RuneManager.AddExistingRune(combinatorRunes[2]);
                             }

                        }

                    }
                }
            }

            #region KeyboardInput

            if ((Keyboard.GetState().IsKeyDown(Keys.Q)) && (previousKeyboard.IsKeyUp(Keys.Q)))
            {
                if (RuneManager.RuneBag[0] >= 1)
                {
                    combinatorRunes[runeCount] = RuneManager.RuneList[0];
                    combinatorRuneText[runeCount] = runes[0];
                    runeCount++;
                    RuneManager.RemoveRune(0, 1);
                }
                if (runeCount == 3)
                {
                    runeCount = 0;
                    currentTower = (combinator.parseCombination(combinatorRunes[0], combinatorRunes[1], combinatorRunes[2]));
                    if (currentTower != Combinator.TowerType.INVALID) altMouseTex = recipes[0];

                    if (currentTower == Combinator.TowerType.INVALID)
                    {
                        RuneManager.AddExistingRune(combinatorRunes[0]);
                        RuneManager.AddExistingRune(combinatorRunes[1]);
                        RuneManager.AddExistingRune(combinatorRunes[2]);
                    }
                }

            }

            if ((Keyboard.GetState().IsKeyDown(Keys.W)) && (previousKeyboard.IsKeyUp(Keys.W)))
            {
                if (RuneManager.RuneBag[1] >= 1)
                {
                    combinatorRunes[runeCount] = RuneManager.RuneList[1];
                    combinatorRuneText[runeCount] = runes[1];
                    runeCount++;
                    RuneManager.RemoveRune(1, 1);
                }

                if (runeCount == 3)
                {
                    runeCount = 0;
                    currentTower = (combinator.parseCombination(combinatorRunes[0], combinatorRunes[1], combinatorRunes[2]));
                    if (currentTower != Combinator.TowerType.INVALID) altMouseTex = recipes[1];

                    if (currentTower == Combinator.TowerType.INVALID)
                    {
                        RuneManager.AddExistingRune(combinatorRunes[0]);
                        RuneManager.AddExistingRune(combinatorRunes[1]);
                        RuneManager.AddExistingRune(combinatorRunes[2]);
                    }
                }

            }

            if ((Keyboard.GetState().IsKeyDown(Keys.E)) && (previousKeyboard.IsKeyUp(Keys.E)))
            {
                if (RuneManager.RuneBag[2] >= 1)
                {
                    combinatorRunes[runeCount] = RuneManager.RuneList[2];
                    combinatorRuneText[runeCount] = runes[2];
                    runeCount++;
                    RuneManager.RemoveRune(2, 1);
                }

                if (runeCount == 3)
                {
                    runeCount = 0;
                    currentTower = (combinator.parseCombination(combinatorRunes[0], combinatorRunes[1], combinatorRunes[2]));
                    if (currentTower != Combinator.TowerType.INVALID) altMouseTex = recipes[2];

                    if (currentTower == Combinator.TowerType.INVALID)
                    {
                        RuneManager.AddExistingRune(combinatorRunes[0]);
                        RuneManager.AddExistingRune(combinatorRunes[1]);
                        RuneManager.AddExistingRune(combinatorRunes[2]);
                    }
                }

            }

            if ((Keyboard.GetState().IsKeyDown(Keys.A)) && (previousKeyboard.IsKeyUp(Keys.A)))
            {
                if (RuneManager.RuneBag[3] >= 1)
                {
                    combinatorRunes[runeCount] = RuneManager.RuneList[3];
                    combinatorRuneText[runeCount] = runes[3];
                    runeCount++;
                    RuneManager.RemoveRune(3, 1);
                }

                if (runeCount == 3)
                {
                    runeCount = 0;
                    currentTower = (combinator.parseCombination(combinatorRunes[0], combinatorRunes[1], combinatorRunes[2]));
                    if (currentTower != Combinator.TowerType.INVALID) altMouseTex = recipes[3];

                    if (currentTower == Combinator.TowerType.INVALID)
                    {
                        RuneManager.AddExistingRune(combinatorRunes[0]);
                        RuneManager.AddExistingRune(combinatorRunes[1]);
                        RuneManager.AddExistingRune(combinatorRunes[2]);
                    }

                }

            }

            if ((Keyboard.GetState().IsKeyDown(Keys.S)) && (previousKeyboard.IsKeyUp(Keys.S)))
            {
                if (RuneManager.RuneBag[4] >= 1)
                {
                    combinatorRunes[runeCount] = RuneManager.RuneList[4];
                    combinatorRuneText[runeCount] = runes[4];
                    runeCount++;
                    RuneManager.RemoveRune(4, 1);
                }

                if (runeCount == 3)
                {
                    runeCount = 0;
                    currentTower = (combinator.parseCombination(combinatorRunes[0], combinatorRunes[1], combinatorRunes[2]));
                    if (currentTower != Combinator.TowerType.INVALID) altMouseTex = recipes[4];

                    if (currentTower == Combinator.TowerType.INVALID)
                    {
                        RuneManager.AddExistingRune(combinatorRunes[0]);
                        RuneManager.AddExistingRune(combinatorRunes[1]);
                        RuneManager.AddExistingRune(combinatorRunes[2]);
                    }
                }

            }

            if ((Keyboard.GetState().IsKeyDown(Keys.D)) && (previousKeyboard.IsKeyUp(Keys.D)))
            {
                if (RuneManager.RuneBag[5] >= 1)
                {
                    combinatorRunes[runeCount] = RuneManager.RuneList[5];
                    combinatorRuneText[runeCount] = runes[5];
                    runeCount++;
                    RuneManager.RemoveRune(5, 1);
                }

                if (runeCount == 3)
                {
                    runeCount = 0;
                    currentTower = (combinator.parseCombination(combinatorRunes[0], combinatorRunes[1], combinatorRunes[2]));
                    if (currentTower != Combinator.TowerType.INVALID) altMouseTex = recipes[5];

                    if (currentTower == Combinator.TowerType.INVALID)
                    {
                        RuneManager.AddExistingRune(combinatorRunes[0]);
                        RuneManager.AddExistingRune(combinatorRunes[1]);
                        RuneManager.AddExistingRune(combinatorRunes[2]);
                    }
                }

            }

            if ((Keyboard.GetState().IsKeyDown(Keys.Z)) && (previousKeyboard.IsKeyUp(Keys.Z)))
            {
                if (RuneManager.RuneBag[6] >= 1)
                {
                    combinatorRunes[runeCount] = RuneManager.RuneList[6];
                    combinatorRuneText[runeCount] = runes[6];
                    runeCount++;
                    RuneManager.RemoveRune(6, 1);
                }

                if (runeCount == 3)
                {
                    runeCount = 0;
                    currentTower = (combinator.parseCombination(combinatorRunes[0], combinatorRunes[1], combinatorRunes[2]));
                    if (currentTower != Combinator.TowerType.INVALID) altMouseTex = recipes[6];

                    if (currentTower == Combinator.TowerType.INVALID)
                    {
                        RuneManager.AddExistingRune(combinatorRunes[0]);
                        RuneManager.AddExistingRune(combinatorRunes[1]);
                        RuneManager.AddExistingRune(combinatorRunes[2]);
                    }
                }

            }

            if ((Keyboard.GetState().IsKeyDown(Keys.X)) && (previousKeyboard.IsKeyUp(Keys.X)))
            {
                if (RuneManager.RuneBag[7] >= 1)
                {
                    combinatorRunes[runeCount] = RuneManager.RuneList[7];
                    combinatorRuneText[runeCount] = runes[7];
                    runeCount++;
                    RuneManager.RemoveRune(7, 1);
                }

                if (runeCount == 3)
                {
                    runeCount = 0;
                    currentTower = (combinator.parseCombination(combinatorRunes[0], combinatorRunes[1], combinatorRunes[2]));
                    if (currentTower != Combinator.TowerType.INVALID) altMouseTex = recipes[7];

                    if (currentTower == Combinator.TowerType.INVALID)
                    {
                        RuneManager.AddExistingRune(combinatorRunes[0]);
                        RuneManager.AddExistingRune(combinatorRunes[1]);
                        RuneManager.AddExistingRune(combinatorRunes[2]);
                    }
                }

            }

            if ((Keyboard.GetState().IsKeyDown(Keys.C)) && (previousKeyboard.IsKeyUp(Keys.C)))
            {
                if (RuneManager.RuneBag[8] >= 1)
                {
                    combinatorRunes[runeCount] = RuneManager.RuneList[8];
                    combinatorRuneText[runeCount] = runes[8];
                    runeCount++;
                    RuneManager.RemoveRune(8, 1);
                }

                if (runeCount == 3)
                {
                    runeCount = 0;
                    currentTower = (combinator.parseCombination(combinatorRunes[0], combinatorRunes[1], combinatorRunes[2]));
                    if (currentTower != Combinator.TowerType.INVALID) altMouseTex = recipes[8];

                    if (currentTower == Combinator.TowerType.INVALID)
                    {
                        RuneManager.AddExistingRune(combinatorRunes[0]);
                        RuneManager.AddExistingRune(combinatorRunes[1]);
                        RuneManager.AddExistingRune(combinatorRunes[2]);
                    }

                }

            }

            #endregion

            #endregion

            #region UpdateRecipes

            for (int i = 0; i < 12; i++)
            {
                if ((RuneManager.CheckRecipe[i] == true) && (mouseRec.Intersects(recipeRectangles[i])))
                {
                    currentDrawString = RuneManager.RecipeBag[i];
                    break;
                }

                currentDrawString = null;
            }

            #endregion

            previousKeyboard = Keyboard.GetState();
        }