SunsetHigh.Hero.isPickpocketing C# (CSharp) Method

isPickpocketing() public method

public isPickpocketing ( ) : bool
return bool
        public bool isPickpocketing()
        {
            return ppActive;
        }

Usage Example

Ejemplo n.º 1
0
 /// <summary>
 /// Handles the Hero's pickpocketing ability; call this method in the Game's update
 /// cycle (AFTER calling KeyboardManager.update())
 /// </summary>
 /// <param name="hero">The main character</param>
 /// <param name="targets">List of characters in the scene; one that is in range is chosen randomly</param>
 public static void handlePickpocketing(Hero hero, List<Character> targets)
 {
     nullCheck();
     if (KeyboardManager.isKeyPressed(keyTypes[(int)KeyInputType.Pickpocket]))
     {
         if (hero.isPickpocketing())
         {
             Item item = hero.stopPickpocket();
             System.Diagnostics.Debug.WriteLine("Stole " + Enum.GetName(typeof(Item), item));
         }
         else if (!hero.isPickpocketing())
         {
             //naive search through a list of characters
             // We should probably do this on a per-room basis later, for efficiency.
             // And/or use some sort of "expanding circle" search.
             for(int i = 0; i < targets.Count; i++)
             {
                 if (hero.inRangeAction(targets[i]))
                 {
                     hero.startPickpocket(targets[i]);
                     break;
                 }
             }
         }
     }
 }