Ejemplo n.º 1
0
        protected void CompileAndShareReferences(GraphInterlink requester, HashSet <GraphInterlink> commonInterlinks, Dictionary <string, UnityGraphObject> commonVariablesByID)
        {
            if (commonInterlinks.Contains(this))
            {
                return;
            }

            if (!AssociatedLinks.Contains(requester))
            {
                AssociatedLinks.Add(requester);
            }

            commonInterlinks.Add(this);
            interlinks = commonInterlinks;

            for (int i = 0; i < ConnectedUnityObjects.Count; i++)
            {
                UnityGraphObject obj = ConnectedUnityObjects[i];

                if (commonVariablesByID.ContainsKey(obj.ID))
                {
                    Debug.LogWarning("More than one object with ID " + obj.ID + " detected. Only one will be kept.");
                }
                else
                {
                    commonVariablesByID.Add(obj.ID, obj);
                }
            }
            VariablesByID = commonVariablesByID;

            for (int i = 0; i < AssociatedLinks.Count; i++)
            {
                AssociatedLinks[i].CompileAndShareReferences(this, commonInterlinks, commonVariablesByID);
            }
        }
        void Awake()
        {
            if (AssociatedInterlink == null)
            {
                AssociatedInterlink = GetComponent <GraphInterlink>();
            }

            UpdateListeners();
            UpdateAppearence();
        }
Ejemplo n.º 3
0
 protected void ValidateVariableConnections(GraphInterlink interlink)
 {
     for (int i = interlink.ConnectedUnityObjects.Count - 1; i >= 0; i--)
     {
         UnityGraphObject obj = interlink.ConnectedUnityObjects[i];
         if (!interlink.IsInRange(obj.gameObject))
         {
             Debug.LogWarning("Object not in range of graph " + name + ": " + obj.ID);
             interlink.ConnectedUnityObjects.RemoveAt(i);
             if (VariablesByID != null)
             {
                 VariablesByID.Remove(obj.ID);
             }
         }
     }
 }