public void SetNodeGraph(NodeGraph nodeGraph)
        {
            Reset();

            if (nodeGraph == null)
            {
                return;
            }

            m_blackboardProperties = nodeGraph.BlackboardProperties;
            SerializedObject serializedGraph = new SerializedObject(nodeGraph);

            m_serializedBlackboardElements = serializedGraph.FindProperty(NodeGraph.BlackboardProperties_VarName)
                                             .FindPropertyRelative(BlackboardProperties.AllElements_VarName);
            LoadElements();
        }
示例#2
0
        private void ValidateBlackboardElement(int undoGroup = -1)
        {
            TargetProperty.serializedObject.Update();

            if (undoGroup == -1)
            {
                undoGroup = Undo.GetCurrentGroup();
            }

            BlackboardSetter target = (Target as BlackboardSetter);

            if (BlackboardProperties.GetElementById(target.BlackboardElementId) == null)
            {
                TargetProperty.FindPropertyRelative(BlackboardSetter.BlackboardElementIdVarName).stringValue = "";
                SerializedProperty setterValueProp = TargetProperty.FindPropertyRelative(BlackboardSetter.SetterValueVarName);
                setterValueProp.managedReferenceValue = null;
                TargetProperty.serializedObject.ApplyModifiedProperties();
            }
            Undo.CollapseUndoOperations(undoGroup);
            TargetProperty.serializedObject.Update();
        }
        private void ValidateBlackboardElement(int undoGroup = -1)
        {
            TargetProperty.serializedObject.Update();

            if (undoGroup == -1)
            {
                undoGroup = Undo.GetCurrentGroup();
            }

            BlackboardConditional target = (Target as BlackboardConditional);

            if (BlackboardProperties.GetElementById(target.BlackboardElementId) == null)
            {
                TargetProperty.FindPropertyRelative(BlackboardConditional.BlackboardElementIdVarName).stringValue = "";
                SerializedProperty conditionalsList = TargetProperty.FindPropertyRelative(BlackboardConditional.ConditionalsVarName);
                NodeGraph.RemoveAllOutportsFromNode(TargetProperty);
                conditionalsList.arraySize = 0;
                TargetProperty.serializedObject.ApplyModifiedProperties();
            }
            Undo.CollapseUndoOperations(undoGroup);
            TargetProperty.serializedObject.Update();
        }
 private void Reset()
 {
     m_blackboardProperties         = null;
     m_serializedBlackboardElements = null;
     ClearElements();
 }