Ejemplo n.º 1
0
 private void SearchChilds(AINodeContainer container)
 {
     foreach (AINode node in container.Childs)
     {
         AllNodes.Add(node);
         if (node is AINodeContainer)
         {
             AINodeContainer c = node as AINodeContainer;
             SearchChilds(c);
         }
     }
 }
Ejemplo n.º 2
0
        private static void SearchAndSetChild(Transform t, AINodeContainer composite, AIMember aiMember)
        {
            foreach (Transform child in t)
            {
                AINode node = null;

                SelectMono selectMono = child.GetComponent <SelectMono>();
                if (selectMono != null)
                {
                    node = selectMono.Create();
                }

                SequeterMono sequterMono = child.GetComponent <SequeterMono>();
                if (sequterMono != null)
                {
                    node = sequterMono.Create();
                }

                ConditionMono conditionMono = child.GetComponent <ConditionMono>();
                if (conditionMono != null)
                {
                    if (conditionMono is WhileConditionMono)
                    {
                        WhileConditionMono wCondition = conditionMono as WhileConditionMono;
                        node = wCondition.Create(aiMember);
                    }
                    else
                    {
                        node = conditionMono.Create(aiMember);
                    }
                }

                PrintActionMono printMono = child.GetComponent <PrintActionMono>();
                if (printMono != null)
                {
                    node = printMono.Create();
                }

                DelayActionMono delayMono = child.GetComponent <DelayActionMono>();
                if (delayMono != null)
                {
                    node = delayMono.Create();
                }

                SetValActionMono setValMono = child.GetComponent <SetValActionMono>();
                if (setValMono != null)
                {
                    node = setValMono.Create(aiMember);
                }

                #region AGAction
                CustomAiNodeMono customMono = child.GetComponent <CustomAiNodeMono>();
                if (customMono != null)
                {
                    node = customMono.Create();
                }
                MonsterSwitchNavNodeMono monsterNavMono = child.GetComponent <MonsterSwitchNavNodeMono>();
                if (monsterNavMono != null)
                {
                    node = monsterNavMono.Create();
                }
                ShootBulletNodeMono shootMono = child.GetComponent <ShootBulletNodeMono>();
                if (shootMono != null)
                {
                    node = shootMono.Create();
                }
                MonsterAtkNodeMono monsterAtkMono = child.GetComponent <MonsterAtkNodeMono>();
                if (monsterAtkMono != null)
                {
                    node = monsterAtkMono.Create();
                }

                #endregion
                composite.AddChild(node);
                if (node is AINodeContainer)
                {
                    AINodeContainer nodeC = node as AINodeContainer;
                    SearchAndSetChild(child.transform, nodeC, aiMember);
                }
            }
        }