Пример #1
0
    public void Buy(int itemIndex)
    {
        var item = ItemCreator.CreateItem(itemIndex);

        this.Inventory.BuyItem(item);
        this.PrintInventory();
    }
Пример #2
0
 IEnumerator RunCreatorWithDuration(ItemCreator itemCreator, WaitForSeconds forDuration)
 {
     while (true)
     {
         GameObject itemObj = itemCreator.CreateItem();
         itemObj.transform.position = area.GetRandomPosInArea();
         yield return(forDuration);
     }
 }
Пример #3
0
    void OnMonsterDeath(int id)
    {
        Debug.Log($"Monster with id {id} died, current Monsters is {Monsters.Count}");
        var monster = Monsters.First(e => e.id == id);

        _battleResult.Experience += monster.GetExperience();
        _battleResult.Gold       += Random.Range(50, 500) * _level;
        _battleResult.Items.Add(ItemCreator.CreateItem(monster.level));
        Monsters.Remove(monster);
        positionedMonsters.Remove(positionedMonsters.FirstOrDefault(e => e.Value.id == id).Key);
        allCharacters.Remove(id);
        CheckMonsterDict();
    }
Пример #4
0
 void Refresh()
 {
     for (int i = 0; i < ENTRY_COUNT; i++)
     {
         var itemData = ItemCreator.CreateItem(UnityEngine.Random.Range(1, 20));
         var item     = ScriptableObject.CreateInstance <Item>();
         item.SetData(itemData);
         var entry = Instantiate(prefabShopEntry, shopContainer);
         entry.transform.localScale = Vector3.one;
         entry.SetData(itemData, () => { ShowDisplay(item); }, _currencyModel);
         if (i == 0)
         {
             ShowDisplay(item);
         }
     }
 }