Ejemplo n.º 1
0
 public void ResetTransform()
 {
     if (ConnectedNode != null)
     {
         LinkInfo connect = connectAble.Find(x => { return(x.itemName == ConnectedNode.Body.Name && x.nodeId == ConnectedNode.NodeID); });
         if (connect != null)
         {
             LinkUtil.ResetTargetTranform(Body, ConnectedNode.Body, connect.relativePos, connect.relativeDir);
             Body.OnTranformChanged(new List <LinkItem>()
             {
                 ConnectedNode.Body
             });
         }
     }
 }
Ejemplo n.º 2
0
        void OnMatch(LinkPort itemA, LinkPort itemB)
        {
            if (!Active)
            {
                return;
            }

            highter.HighLightTarget(itemA.gameObject, Color.green);
            var linkInfo = itemA.connectAble.Find(x => x.itemName == itemB.Body.Name && x.nodeId == itemB.NodeID);

            LinkUtil.ResetTargetTranform(itemA.Body, itemB.Body, linkInfo.relativePos, linkInfo.relativeDir);
            LinkUtil.UpdateBrotherPos(itemA.Body, new List <LinkItem>());

            if (linkItem)
            {
                linkItem.isMatching = true;
            }
        }
Ejemplo n.º 3
0
        public static void UpdateBrotherPos(LinkItem target, List <LinkItem> context)
        {
            if (target.ChildNodes == null || target.ChildNodes.Count == 0)
            {
                return;
            }

            context.Add(target);

            foreach (var item in target.ChildNodes)
            {
                if (item.ConnectedNode != null && !context.Contains(item.ConnectedNode.Body))
                {
                    var targetNode = item.ConnectedNode.Body;
                    var linkInfo   = item.ConnectedNode.connectAble.Find(x => x.itemName == target.Name && x.nodeId == item.NodeID);

                    LinkUtil.ResetTargetTranform(targetNode, target, linkInfo.relativePos, linkInfo.relativeDir);
                    UpdateBrotherPos(targetNode, context);
                }
            }
        }