Example #1
0
 public Constellation(ConstellationScriptData constellationScriptData,
                      NodesFactory nodesFactory,
                      NodeAdded onNodeAdded = null)
 {
     NodesFactory = nodesFactory;
     SetNodes(constellationScriptData.GetNodes(), onNodeAdded);
     SetLinks(constellationScriptData.GetLinks());
 }
Example #2
0
        public Constellation(ConstellationScriptData constellationScriptData,
                             NodesFactory nodesFactory,
                             NodeAdded onNodeAdded = null)
        {
            isConstellationInitialized = false;
            NodesFactory = nodesFactory;
            var newAssembly = new List <ConstellationScriptData>();

            if (nodesFactory.GetStaticScripts() == null)
            {
                foreach (var node in constellationScriptData.Nodes)
                {
                    if (node.Namespace == ConstellationNodes.NameSpace.NAME)
                    {
                        newAssembly.Add(UnityEngine.JsonUtility.FromJson <ConstellationScriptData>(node.DiscreteParametersData[1].Value.GetString()));
                    }
                }
                nodesFactory.UpdateConstellationScripts(newAssembly.ToArray());
            }
            SetNodes(constellationScriptData.GetNodes(), onNodeAdded);
            SetLinks(constellationScriptData.GetLinks());
            isConstellationInitialized = true;
        }
Example #3
0
        public Constellation(ConstellationScriptData constellationScriptData, NodesFactory nodesFactory, IConstellationFileParser constellationFileParser, NodeAdded onNodeAdded = null)
        {
            fileParser = constellationFileParser;
            isConstellationInitialized = false;
            NodesFactory = nodesFactory;
            var newAssembly = new List <ConstellationScriptData>();

            if (nodesFactory.GetStaticScripts() == null || nodesFactory.GetIsLocalScope())
            {
                foreach (var node in constellationScriptData.Nodes)
                {
                    if (node.Namespace == ConstellationNodes.NameSpace.NAME)
                    {
                        newAssembly.Add(constellationFileParser.ParseConstellationScript(node.DiscreteParametersData[1].Value.GetString()));
                    }
                }
                nodesFactory.UpdateConstellationScripts(newAssembly.ToArray());
                nodesFactory.SetLocalScope();
            }
            SetNodes(constellationScriptData.GetNodes(), onNodeAdded);
            SetLinks(constellationScriptData.GetLinks());
            isConstellationInitialized = true;
        }