예제 #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;
 }