コード例 #1
0
    /// <summary>
    /// Gets the quests from the filename specified
    /// </summary>
    private void GetQuestsFromFile()
    {
        PlayerQuestArray quests = JsonArrayHandler <PlayerQuestArray> .ReadJsonFile(filePath);

        foreach (var quest in quests.items)
        {
            currentQuests.Add(quest);
        }
        questManager.InitQuestScriptableObjects(quests);
    }
コード例 #2
0
    public void ReadFile()
    {
        NPCStates npcFileStates = JsonArrayHandler <NPCStates> .ReadJsonFile(filePath);

        npcStates.Clear();
        foreach (var npcState in npcFileStates.items)
        {
            npcStates.Add(npcState);
        }

        for (int i = 0; i < npcStates.Count; i++)
        {
            npcs[i].currentQuest = npcStates[i].questNumber;
        }
    }
コード例 #3
0
    public void InitDictionary()
    {
        PlayerItems playerItems = JsonArrayHandler <PlayerItems> .ReadJsonFile(Path.Combine(Application.persistentDataPath, "PlayerItems.json"));

        items.Clear();

        foreach (PlayerItem item in playerItems.items)
        {
            GameObject go = new GameObject();
            go.AddComponent <Item>();
            Item gameObjectItem = go.GetComponent <Item>();
            gameObjectItem.Name = item.item.name;
            gameObjectItem.Type = item.item.itemType;

            items.Add(gameObjectItem, item.amount);

            if (item.item.name.Equals("Trident"))
            {
                Weapons[1].gameObject.SetActive(true);
            }
        }
    }