private void AddScriptableScene()
    {
        // If there isn't an AllConditions instance yet, put a message in the console and return.
        if (!AllGameScriptableScenes.Instance)
        {
            Debug.LogError("AllGameScriptableScenes has not been created yet.");
            return;
        }

        ScriptableScene newScene = ScriptableSceneEditor.CreateScriptableScene();

        newScene.name = NEW_SCENE_BASE_NAME;

        ScriptableObjectUtility.AddScriptableObject(AllGameScriptableScenes.Instance, ref newScene, ref AllGameScriptableScenes.Instance.scriptableScenes, "Created new Scriptable Scene");
    }
    private void AddItem(string name = "")
    {
        Item newItem = ScriptableObject.CreateInstance <Item>();

        newItem.inventoryItemList = this.inventoryItemList;

        if (name == null || name == "")
        {
            newItem.name = "New Item " + inventoryItemList.itemList.Length + 1;
        }
        else
        {
            newItem.name = name;
        }

        ScriptableObjectUtility.AddScriptableObject(inventoryItemList, ref newItem, ref inventoryItemList.itemList, "Created new Item");
    }
    private void AddQuest(string name = "")
    {
        Quest newQuest = ScriptableObject.CreateInstance <Quest>();

        newQuest.parentQuestList = this.targetQuestsList;

        if (name == null || name == "")
        {
            newQuest.name = "New Quest " + targetQuestsList.quests.Length + 1;
        }
        else
        {
            newQuest.name = name;
        }

        ScriptableObjectUtility.AddScriptableObject(targetQuestsList, ref newQuest, ref targetQuestsList.quests, "Created new Quest");
    }
Example #4
0
    private void AddSaveData(string newSaveDataName = null)
    {
        // If there isn't an AllConditions instance yet, put a message in the console and return.
        if (!AllSavesData.Instance)
        {
            Debug.LogError("AllSavesData has not been created yet.");
            return;
        }

        // Create a condition based on the description.
        SaveData newSaveData = SaveDataEditor.createPersistentDataSave();

        newSaveData.name = (newSaveDataName != null) ? newSaveDataName : "New SaveData";

        ScriptableObjectUtility.AddScriptableObject(AllSavesData.Instance,
                                                    ref newSaveData,
                                                    ref AllSavesData.Instance.saveDatas,
                                                    "Created new SaveData"
                                                    );
    }
Example #5
0
    private LocalizedText AddLocalizedText(string LocalizedTextName = "")
    {
        // Create a new scriptable instance of LocalizedText
        LocalizedText newText = ScriptableObject.CreateInstance <LocalizedText>();

        Undo.RecordObject(newText, "new localized text");

        // Add the new item to the group that create its
        newText.textsGroup = this.locTextGroup;

        // Give the new LocalizedText a name
        if (LocalizedTextName == null || LocalizedTextName == "")
        {
            newText.name = LocalizedTextName + locTextGroup.localizedTextsList.Count + 1;
        }
        else
        {
            newText.name = LocalizedTextName;
        }

        // Assets folder name for the object must match the name
        // of the LocalizedText ID which must be unique within the group
        newText.textID = newText.name;

        // Create a localizedTextsList with the same lenght as local Game LanguageList...
        newText.localizedTextsList = new List <LocalizableElement>(locTextGroup.localGameLanguagesList.Length);

        // ...and create the localizableElements
        for (int i = 0; i < locTextGroup.localGameLanguagesList.Length; i++)
        {
            newText.localizedTextsList.Add(new LocalizableElement(locTextGroup.localGameLanguagesList[i].gameLanguage, ""));
        }

        // Attach the new localizedText as a child of the group in assests folder
        ScriptableObjectUtility.AddScriptableObject(locTextGroup, ref newText, ref locTextGroup.localizedTextsList, "Created new Localized Text");

        return(newText);
    }
Example #6
0
    private void AddCondition(string description)
    {
        // If there isn't an AllConditions instance yet, put a message in the console and return.
        if (!AllConditions.Instance)
        {
            Debug.LogError("AllConditions has not been created yet.");
            return;
        }

        // Create a condition based on the description.
        Condition newCondition = ConditionEditor.CreateCondition(description);

        // The name is what is displayed by the asset so set that too.
        newCondition.name = description;

        ScriptableObjectUtility.AddScriptableObject(AllConditions.Instance,
                                                    ref newCondition,
                                                    ref AllConditions.Instance.conditions,
                                                    "Created new Condition"
                                                    );

        // Recreate the condition description array with the new added Condition.
        SetAllConditionDescriptions();
    }