public override void AddObject(string name_object, string description_object, Item item_to_addd, int count)
    {
        can_spawn_newItem = true;
        ChooseItem chooseItem = null;

        //Debug.Log("Point 0 key = "+ _save_items_with_id[item_to_addd.Id].Id);
        if (_save_items_with_id.ContainsKey(item_to_addd.Id))
        {
            can_spawn_newItem = false;

            SetCount(item_to_addd.Id, count);
        }
        if (can_spawn_newItem)
        {
            GameObject go = base.AddObject(name_object, description_object);
            chooseItem = go.GetComponent <ChooseItem>();

            chooseItem.SetParams(name_object, description_object);
            chooseItem.AddItemScriptableObject(item_to_addd);

            Items.AddItemToStorage(item_to_addd);

            _save_chooseitems.Add(item_to_addd.Id, chooseItem);
            _save_items_with_id.Add(item_to_addd.Id, item_to_addd);

            SetCount(item_to_addd.Id, count);
        }
    }
    public ItemsList GetRandomItems(ItemsList list_of_allitems, int chanse)
    {
        ItemsList list_of_random_items = new ItemsList();

        int random_int = Random.Range(0, 101);

        for (int i = 0; i < list_of_allitems.GetList().Count; i++)
        {
            if (random_int <= chanse)
            {
                list_of_random_items.AddItemToStorage(list_of_allitems.GetList()[i]);
            }
        }

        return(list_of_random_items);
    }
Esempio n. 3
0
 public void AddMineItem(Item item, int count)
 {
     _items_to_mine.AddItemToStorage(item);
     _count_items_to_mine = count;
 }