Пример #1
0
        protected override void Init()
        {
            base.Init();
            BlackBoardGraph g = (graph as BlackBoardGraph);

            g.BlackboardValuesSet -= UpdateValue;
            g.BlackboardValuesSet += UpdateValue;
            g.BlackboardValuesRetrievedExternally -= UpdateValue;
            g.BlackboardValuesRetrievedExternally += UpdateValue;
        }
Пример #2
0
        public static BlackboardVariableInstance Create(BlackboardObject value, BlackBoardGraph graph)
        {
            Node.graphHotfix = graph;
            Undo.RecordObject(graph, "Create Blackboard Value Instance");
            BlackboardVariableInstance node = CreateInstance <BlackboardVariableInstance>();

            node.value = value;
            node.graph = graph;
            if (node.name == null || node.name.Trim() == "")
            {
                node.name = NodeEditorUtilities.NodeDefaultName(typeof(BlackboardVariableInstance));
            }
            node.AddDynamicOutput(value.Type, ConnectionType.Multiple, TypeConstraint.InheritedInverse, "ValueOut");
            node.AddDynamicInput(value.Type, ConnectionType.Override, TypeConstraint.Inherited, "ValueIn");
            graph.nodes.Add(node);
            Undo.RegisterCreatedObjectUndo(node, "Create Blackboard Value Instance");
            AssetDatabase.AddObjectToAsset(node, graph);
            return(node);
        }
Пример #3
0
 public override void OnCreateConnection(NodePort from, NodePort to)
 {
     if (to == GetPort("bbGraph") && from.ValueType.IsAssignableFrom(typeof(BlackBoardGraph)))
     {
         bbGraph = (BlackBoardGraph)from.GetOutputValue();
         foreach (BlackboardObject bbo in bbGraph.BlackboardValues)
         {
             if (HasPort(bbo.name))
             {
                 //TODO Increment names
                 Debug.Log("Trying to add a port with a variable of the same name.");
                 continue;
             }
             else
             {
                 AddDynamicOutput(bbo.Type, ConnectionType.Multiple, TypeConstraint.InheritedInverse, bbo.name);
             }
         }
     }
 }