示例#1
0
 public void UseItem()
 {
     if (mochila.GetIndex() != -1)
     {
         if (this.mochila.items[mochila.GetIndex()] is Potion && mochila.GetIndex() <= mochila.items.Count - 1)
         {
             AddTurns();
         }
         else if (this.mochila.items[mochila.GetIndex()] is Armadura && mochila.GetIndex() <= mochila.items.Count - 1)
         {
             armadura = new Armadura();
         }
         else if (this.mochila.items[mochila.GetIndex()] is Espada && mochila.GetIndex() <= mochila.items.Count - 1)
         {
             espada = new Espada();
         }
         this.mochila.UseItem();
     }
 }
示例#2
0
 public bool TryAdd(Cosa item)
 {
     if (items.Count < 10 || item is Moneda)
     {
         if (item is Moneda)
         {
             this.AddCoins();
             return(true);
         }
         else
         {
             items.Add(item);
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
示例#3
0
        public bool UseItem()
        {
            if (this.ItemIndex != -1)
            {
                Cosa objeto = items[this.ItemIndex];

                if (objeto is Moneda)
                {
                    AddCoins();
                    Borra();
                    return(true);
                }
                else if (objeto is Potion)
                {
                    Borra();
                    return(true);
                }
                else if (objeto is Espada)
                {
                    Borra();
                    return(true);
                }
                else if (objeto is Armadura)
                {
                    Borra();
                    return(true);
                }
                else
                {
                    this.ItemIndex = -1;
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
示例#4
0
 public void PutArmor()
 {
     this.objeto = new Armadura();
 }
示例#5
0
 public void PutSword()
 {
     this.objeto = new Espada();
 }
示例#6
0
 public void PutPotion()
 {
     this.objeto = new Potion();
 }
示例#7
0
 public void PutCoin()
 {
     this.objeto = new Moneda();
 }
示例#8
0
 public Celda()
 {
     this.valor  = TipoCelda.Empty;
     this.shadow = true;
     this.objeto = null;
 }
示例#9
0
 public void RemoveCoin()
 {
     this.objeto = null;
 }