Пример #1
0
 void PickUpItem()
 {
     itemPosition = item.transform;
     if (InRange())
     {
         basePotionItem = item.GetComponent <Item>().basePotionItem;
         transform.LookAt(item.transform.position);
         inventory.AddItemPotion(basePotionItem);
     }
 }
Пример #2
0
    //Unosimo trenutni item u ovom slucaju potion u stack colekciju
    //i ispitujemo da li je veca od 1 ukoliko jeste
    //ispisujemo u slotu broj koliko imamo potion
    public void AddPotionItem(BasePotionItem potion)
    {
        Potionitems.Push(potion);
        if (Potionitems.Count > 1)
        {
            stackText.text = Potionitems.Count.ToString();
        }


        ChangeSprite(potion.SpriteNeutral, potion.SpriteHighlighted);
    }
Пример #3
0
        public void OnMouseDown()
        {
            ClickToMove.pickingMode = true;
            if (gameObject.name != string.Empty)
            {
                caser = gameObject.name;
                CreateClickedItem(caser);
            }
            basePotionItem = CreateNewPotion.newPotion;

            Player.GetComponent <ClickToMove>().item = gameObject;
        }
Пример #4
0
 public bool AddItemPotion(BasePotionItem item)
 {
     // ako ovaj item ne moze da se stackuje tj da se prelepi preko sebe u slot
     //onda ga postavljamo na novi slot
     if (item.StackSize == 1)
     {
         PlaceEmpty(item);
         return(true);
     }
     else
     {
         //u slucaju da moze da se stavi preko sebe onda idemo ovako
         foreach (GameObject slot  in allSlots)
         {
             //dohbata slot kalsu
             Slot tmp = slot.GetComponent <Slot>();
             //pitamo dal je  slot prazan
             // ako nije a moze da se stackuje
             if (!tmp.IsEmpty)
             {
                 //
                 if (tmp.CurrentItem.ItemType == item.ItemType && tmp.isAvailabele)
                 {
                     tmp.AddPotionItem(item);
                     tmp.CurrentItem.StackSize--;
                     return(true);
                 }
             }
         }
         //ako nismo nasli da postavimo item koji moze da se postavi preko drugog onda trazimo novi
         //slobodan slot i postavljamo ga tu
         if (EmptySlot > 0)
         {
             PlaceEmpty(item);
         }
     }
     return(false);
 }
Пример #5
0
 //ova funkcija ce da preleti kroz sve objekte u slotovima i kad nadje slobodan slot tu ce ubaciti item
 private bool PlaceEmpty(BasePotionItem item)
 {
     // ako je broj praznih slotova  veci od nula
     if (EmptySlot > 0)
     {
         //za svaki slot u slotovima
         foreach (GameObject slot in allSlots)
         {
             //dohvati komponentu slot
             Slot tmp = slot.GetComponent <Slot>();
             //i ukoliko je prazan
             if (tmp.IsEmpty)
             {
                 //pozivamo da se doda item
                 tmp.AddPotionItem(item);
                 //smanjujemo broj slotova
                 EmptySlot--;
                 return(true);
             }
         }
     }
     return(false);
 }
Пример #6
0
    public static void CreatePotion(int potionType, Sprite spriteNeutral, Sprite spriteHighlighted, int stackSize)
    {
        newPotion = new BasePotionItem();

        string typePotion = ChoosePotionType(potionType);

        int indexLevelName = UnityEngine.Random.Range(0, (potionLevelName.Length));

        if (indexLevelName == 0)
        {
            newPotion.ItemDescription = "Common " + typePotion + " most of poor people use it mob and helots";
        }
        else if (indexLevelName == 1)
        {
            newPotion.ItemDescription = "Good " + typePotion + " use by milit and light infantry";
            PowerPotionMultiplier(1, potionType);
        }
        else if (indexLevelName == 2)
        {
            newPotion.ItemDescription = "Medium " + typePotion + " veri useful";
            PowerPotionMultiplier(2, potionType);
        }
        else if (indexLevelName == 3)
        {
            newPotion.ItemDescription = "Very good " + typePotion + " used by medium troops";
            PowerPotionMultiplier(3, potionType);
        }
        else if (indexLevelName == 4)
        {
            newPotion.ItemDescription = "Nice " + typePotion + " used by legio protectores";
            PowerPotionMultiplier(4, potionType);
        }
        else if (indexLevelName == 5)
        {
            newPotion.ItemDescription = "Impresive " + typePotion + " wore by generals and centurions";
            PowerPotionMultiplier(5, potionType);
        }
        else if (indexLevelName == 6)
        {
            newPotion.ItemDescription = "Exelend " + typePotion + " is epic pice of art work";
            PowerPotionMultiplier(6, potionType);
        }

        newPotion.ItemName          = potionLevelName[indexLevelName] + typePotion;
        newPotion.ItemType          = ItemTypes.POTION;
        newPotion.StackSize         = stackSize;
        newPotion.SpriteNeutral     = spriteNeutral;
        newPotion.SpriteHighlighted = spriteHighlighted;
        newPotion = new BasePotionItem(
            newPotion.ItemName,
            newPotion.ItemDescription,
            newPotion.ItemID,
            newPotion.ItemType,
            newPotion.StackSize,
            newPotion.SpriteNeutral,
            newPotion.SpriteHighlighted,
            newPotion.PotionType,
            newPotion.Stamina,
            newPotion.Endurance,
            newPotion.Agility,
            newPotion.Strenght
            );
    }