Example #1
0
        private MilitaryKind findSuccessorRecruitable_r(MilitaryKindList allMilitaryKinds, Architecture recruiter, MilitaryKind prev)
        {
            if (prev.successor.GetMilitaryKindList().Count == 0)
            {
                return(prev);
            }
            prev.findSuccessor_visited = true;
            MilitaryKindList toVisit = new MilitaryKindList();

            foreach (MilitaryKind i in prev.successor.GetMilitaryKindList())
            {
                if (!i.findSuccessor_visited && recruiter.GetNewMilitaryKindList().GameObjects.Contains(i) && allMilitaryKinds.GetList().GameObjects.Contains(i))
                {
                    toVisit.Add(i);
                }
            }
            if (toVisit.Count == 0)
            {
                return(prev);
            }
            return(findSuccessorRecruitable_r(allMilitaryKinds, recruiter, toVisit[GameObject.Random(toVisit.Count)] as MilitaryKind));
        }