Пример #1
0
 public BonusBox getClosestBonusBox(ref Hero hero, ref double outdist)
 {
     if (this.bonusBoxes.Count == 1)
     {
         outdist = this._getDistance((int)Math.Round(Conversion.Fix(Math.Round(hero.getPosX()))), (int)Math.Round(Conversion.Fix(Math.Round(hero.getPosY()))), ((BonusBox)this.bonusBoxes[0]).getPosX(), ((BonusBox)this.bonusBoxes[0]).getPosY());
         return((BonusBox)this.bonusBoxes[0]);
     }
     if (this.bonusBoxes.Count > 1)
     {
         BonusBox box2 = (BonusBox)this.bonusBoxes[0];
         double   num  = this._getDistance((int)Math.Round(Conversion.Fix(Math.Round(hero.getPosX()))), (int)Math.Round(Conversion.Fix(Math.Round(hero.getPosY()))), box2.getPosX(), box2.getPosY());
         int      num5 = this.bonusBoxes.Count - 1;
         for (int i = 1; i <= num5; i++)
         {
             BonusBox box3 = (BonusBox)this.bonusBoxes[i];
             double   num3 = this._getDistance((int)Math.Round(Conversion.Fix(Math.Round(hero.getPosX()))), (int)Math.Round(Conversion.Fix(Math.Round(hero.getPosY()))), box3.getPosX(), box3.getPosY());
             if (!(Math.Min(num, num3) == num))
             {
                 box2 = box3;
                 num  = num3;
             }
         }
         outdist = num;
         return(box2);
     }
     outdist = double.MaxValue;
     return(null);
 }
Пример #2
0
        public void removeBonusBox(string code)
        {
            int num2 = this.bonusBoxes.Count - 1;

            for (int i = 0; i <= num2; i++)
            {
                BonusBox box = new BonusBox();
                box = (BonusBox)this.bonusBoxes[i];
                if (box.getCode() == code)
                {
                    this.bonusBoxes.RemoveAt(i);
                    break;
                }
            }
        }
Пример #3
0
 public void removeBonusBox(string code)
 {
     int num2 = this.bonusBoxes.Count - 1;
     for (int i = 0; i <= num2; i++)
     {
         BonusBox box = new BonusBox();
         box = (BonusBox) this.bonusBoxes[i];
         if (box.getCode() == code)
         {
             this.bonusBoxes.RemoveAt(i);
             break;
         }
     }
 }