Exemple #1
0
    public override void OnInspectorGUI()
    {
        // Configuration:
        bool _isDecisionNode = EditorGUILayout.Toggle("Decision node?", node.isDecisionNode);

        GameObject[] _objectsToTrigger = PrairieGUI.drawObjectList("Objects To Trigger", node.objectsToTrigger);

        EditorGUILayout.LabelField("Name", node.name);
        EditorGUILayout.LabelField("Content");
        EditorGUI.indentLevel += 1;
        string _content = EditorGUILayout.TextArea(node.content);

        EditorGUI.indentLevel -= 1;

        // Read-Only Display:
        PrairieGUI.drawObjectListReadOnly("Children", node.children);
        PrairieGUI.drawObjectListReadOnly("Parents", node.parents.ToArray());

        // Save changes to the TwineNode if the user edits something in the GUI:
        if (GUI.changed)
        {
            Undo.RecordObject(node, "Modify Twine Node");
            node.isDecisionNode   = _isDecisionNode;
            node.objectsToTrigger = _objectsToTrigger;
            node.content          = _content;
        }
    }
Exemple #2
0
    public override void OnInspectorGUI()
    {
        // Configuration:
        EditorGUILayout.LabelField("Name", node.name);
        EditorGUILayout.LabelField("Content");
        EditorGUI.indentLevel += 1;
        string _content = EditorGUILayout.TextArea(node.content);

        EditorGUI.indentLevel -= 1;

        bool _isDecisionNode = EditorGUILayout.Toggle("Decision node?", node.isDecisionNode);

        GameObject[] _objectsToTrigger = PrairieGUI.drawObjectList("Objects To Trigger", node.objectsToTrigger);
        GameObject[] _objectsToEnable  = PrairieGUI.drawObjectList <GameObject>("Objects To Enable:", node.objectsToEnable);
        GameObject[] _objectsToRotate  = PrairieGUI.drawObjectList <GameObject>("Objects To Rotate:", node.objectsToRotate);
        int          _rotX             = EditorGUILayout.IntField("X-axis rotation amount:", node.rotX);
        int          _rotY             = EditorGUILayout.IntField("Y-axis rotation amount:", node.rotY);
        int          _rotZ             = EditorGUILayout.IntField("Z-axis rotation amount:", node.rotZ);

        GameObject[] _objectsToTransform = PrairieGUI.drawObjectList <GameObject>("Objects To Transform:", node.objectsToTransform);
        int          _trX = EditorGUILayout.IntField("X-axis transform amount:", node.trX);
        int          _trY = EditorGUILayout.IntField("Y-axis transform amount:", node.trY);
        int          _trZ = EditorGUILayout.IntField("Z-axis transform amount:", node.trZ);

        // Read-Only Display:
        PrairieGUI.drawObjectListReadOnly("Children", node.children);
        PrairieGUI.drawObjectListReadOnly("Parents", node.parents.ToArray());

        // Save changes to the TwineNode if the user edits something in the GUI:
        if (GUI.changed)
        {
            Undo.RecordObject(node, "Modify Twine Node");
            node.isDecisionNode     = _isDecisionNode;
            node.objectsToTrigger   = _objectsToTrigger;
            node.content            = _content;
            node.objectsToEnable    = _objectsToEnable;
            node.objectsToRotate    = _objectsToRotate;
            node.objectsToTransform = _objectsToTransform;
            node.trX  = _trX;
            node.trY  = _trY;
            node.trZ  = _trZ;
            node.rotX = _rotX;
            node.rotY = _rotY;
            node.rotZ = _rotZ;
        }
    }