示例#1
0
    public void ReveiveRewards()
    {
        int rand             = Random.Range(0, 100);
        PersistentScript per = GameObject.FindGameObjectWithTag("Persistent").GetComponent <PersistentScript>();

        per._gold  += _enemy.Gold;
        per._heat  += _enemy.Heat;
        per._magic += _enemy.Essence;

        if (rand > 90)
        {
            print("Got a rare");
            per.AddInvenotryItem(_enemy.RareID, 1);
            return;
        }

        if (rand > 80)
        {
            print("Get a common");
            per.AddInvenotryItem(_enemy.CommonID, 1);
            return;
        }

        print("No item");
    }
示例#2
0
 public void BrewPotion()
 {
     if (_ingredientToggle.isOn)
     {
         if (CheckComplete(_selectedID))
         {
             foreach (Ingredient ingredient in _potionShop.GetRecipes()[_selectedID]._ingredients)
             {
                 _persistent.DecreaseItemCount(ingredient._id, ingredient._quantity);
             }
         }
         else
         {
             return;
         }
     }
     else if (_essenceToggle.isOn)
     {
         if (_persistent._magic < _potionShop.GetRecipes()[_selectedID]._cost)
         {
             return;
         }
         else
         {
             _persistent._magic -= _potionShop.GetRecipes()[_selectedID]._cost;
         }
     }
     _persistent.AddInvenotryItem(_potionShop.GetRecipes()[_selectedID]._id, 1);
     _potionShop.OpenClosePotionShop();
 }
示例#3
0
    void CreateItem(List <Ingredient> ingredients, string itemID)
    {
        foreach (Ingredient ingredient in ingredients)
        {
            _persistent.DecreaseItemCount(ingredient._id, ingredient._quantity);
        }

        _persistent.AddInvenotryItem(itemID, 1);
    }
示例#4
0
 public bool BuyFromShop(string id, int count)
 {
     if (_persistent._gold >= _database.GetItemDataByID(id).Cost *count)
     {
         _persistent.AddInvenotryItem(id, count);
         _persistent._gold -= _database.GetItemDataByID(id).Cost *count;
         return(true);
     }
     return(false);
 }