예제 #1
0
 private void BuildTreeRec(TriggerEditorNode node)
 {
     foreach (Transform child in node.TriggerComponent.transform)
     {
         EventFilter        filter      = child.GetComponent <EventFilter>();
         EventResponder     responder   = child.GetComponent <EventResponder>();
         TriggerActionGroup actionGroup = child.GetComponent <TriggerActionGroup>();
         if (filter)
         {
             FilterEditorNode filterNode = new FilterEditorNode(filter, _context);
             node.Add(filterNode);
             BuildTreeRec(filterNode);
         }
         else if (responder)
         {
             ActionEditorNode actionNode = new ActionEditorNode(responder, _context);
             node.Add(actionNode);
             BuildTreeRec(actionNode);
         }
         else if (actionGroup)
         {
             ActionGroupEditorNode groupNode = new ActionGroupEditorNode(actionGroup, _context);
             node.Add(groupNode);
             BuildTreeRec(groupNode);
         }
     }
 }
예제 #2
0
    private List <TriggerEditorNode> GetChildrenNodes(GameObject root)
    {
        // Root is assumed to contain a Trigger component and maybe an EventSender or Function component.
        List <TriggerEditorNode> nodes = new List <TriggerEditorNode>();

        foreach (Transform child in root.transform)
        {
            EventFilter        filter      = child.GetComponent <EventFilter>();
            EventResponder     responder   = child.GetComponent <EventResponder>();
            TriggerActionGroup actionGroup = child.GetComponent <TriggerActionGroup>();
            if (filter)
            {
                FilterEditorNode filterNode = new FilterEditorNode(filter, _context);
                nodes.Add(filterNode);
                BuildTreeRec(filterNode);
            }
            else if (responder)
            {
                ActionEditorNode actionNode = new ActionEditorNode(responder, _context);
                nodes.Add(actionNode);
                BuildTreeRec(actionNode);
            }
            else if (actionGroup)
            {
                ActionGroupEditorNode groupNode = new ActionGroupEditorNode(actionGroup, _context);
                nodes.Add(groupNode);
                BuildTreeRec(groupNode);
            }
        }
        return(nodes);
    }