public void SetObtainedObject(GameItemType itemType)
    {
        // 宝箱コインはランダム
        int itemCount = 1;

        if (itemType == GameItemType.treasureCoin)
        {
            itemCount = UnityEngine.Random.Range(0, 5);
        }
        // 獲得リストに追加
        int newCount = obtainedObjectCounts[itemType.ToString()] + itemCount;

        obtainedObjectCounts[itemType.ToString()] = newCount;
        itemsEffectApplying(itemType);
        viewTreasureUI(itemType);
        Debug.Log(itemType.ToString() + "を獲得");
    }
    public BaseItem GetItem(GameItemType itemType)
    {
        if (gameItems == null || gameItems.Count <= 0)
        {
            Debug.LogError("No items in database");
            return(null);
        }

        foreach (BaseItem i in gameItems)
        {
            if (i.itemType == itemType)
            {
                return(i);
            }
        }

        Debug.LogWarning("The object: " + itemType.ToString() + " could not be found. Please check if the object has an item script with the correct settings and that it is a valid item in the items enum!");

        return(null);
    }
예제 #3
0
 public string GetClassId(GameItemType itemType)
 {
     return(itemType.ToString());
 }