Ejemplo n.º 1
0
 public bool onClick(float mouseX, float mouseY, ref int knowledgePoints, ref Skill curHeld)
 {
     if (buttonBounds.Contains(mouseX, mouseY))
     {
         if (bought)
         {
             curHeld = this;
             return true;
         }
         else if (knowledgePoints >= cost && !locked)
         {
             knowledgePoints -= cost;
             bought = true;
             unlockDeps();
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 2
0
 public bool onPlaceClick(float mouseX, float mouseY, ref Skill curHeld)
 {
     if (upArrowBounds.Contains(mouseX, mouseY))
     {
         if (player.selectedSpell > 0)
         {
             --player.selectedSpell;
         }
     }
     else if (downArrowBounds.Contains(mouseX, mouseY))
     {
         if (player.selectedSpell < 4)
         {
             ++player.selectedSpell;
         }
     }
     else if (!spell.Contains(curHeld))
     {
         if ((curHeld is SkillShape || curHeld == null) && shapeBounds.Contains(mouseX, mouseY))
         {
             spell = new Spell((SkillShape)curHeld, spell.modElement, spell.modTop, spell.modBottom);
         }
         else if (curHeld is SkillMod || curHeld == null)
         {
             if (modMidBounds.Contains(mouseX, mouseY))
             {
                 spell = new Spell(spell.shape, (SkillMod)curHeld, spell.modTop, spell.modBottom);
             }
             else if (modTopBounds.Contains(mouseX, mouseY))
             {
                 spell = new Spell(spell.shape, spell.modElement, (SkillMod)curHeld, spell.modBottom);
             }
             else if (modBottomBounds.Contains(mouseX, mouseY))
             {
                 spell = new Spell(spell.shape, spell.modElement, spell.modTop, (SkillMod)curHeld);
             }
             else
             {
                 return false;
             }
         }
         else
         {
             return false;
         }
         curHeld = null;
         return true;
     }
     return false;
 }
Ejemplo n.º 3
0
 public bool Contains(Skill test)
 {
     return (test != null) && (shape == test || modElement == test || modTop == test || modBottom == test);
 }
Ejemplo n.º 4
0
        public override void Update()
        {
            float mouseX = Main.newMouseState.X * downscale;
            float mouseY = Main.newMouseState.Y * downscale;
            bool clearHeld = true;

            if (Main.newMouseState.LeftButton == ButtonState.Pressed && Main.oldMouseState.LeftButton == ButtonState.Released)
            {
                foreach (Skill skill in player.skills)
                {
                    if (skill.onClick(mouseX, mouseY, ref player.knowledgePoints, ref curHeld))
                    {
                        clearHeld = false;
                    }
                }

                if (!player.spells[player.selectedSpell].onPlaceClick(mouseX, mouseY, ref curHeld) && clearHeld)
                {
                    curHeld = null;
                }
            }
            if (Main.newKeyState.IsKeyDown(Keys.Back) && !Main.oldKeyState.IsKeyDown(Keys.Back))
            {
                Main.Handler = game;
            }
            if (Main.newKeyState.IsKeyDown(Keys.K) && !Main.oldKeyState.IsKeyDown(Keys.K))
            {
                game.player.knowledgePoints = 10000;
            }
        }