Пример #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;
 }