Example #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();
     }
 }
Example #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);
     }
 }
Example #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);
            }
        }
Example #4
0
 public void PutArmor()
 {
     this.objeto = new Armadura();
 }
Example #5
0
 public void PutSword()
 {
     this.objeto = new Espada();
 }
Example #6
0
 public void PutPotion()
 {
     this.objeto = new Potion();
 }
Example #7
0
 public void PutCoin()
 {
     this.objeto = new Moneda();
 }
Example #8
0
 public Celda()
 {
     this.valor  = TipoCelda.Empty;
     this.shadow = true;
     this.objeto = null;
 }
Example #9
0
 public void RemoveCoin()
 {
     this.objeto = null;
 }