示例#1
0
        public static BTProgram CreateBehaviourProgram(BTSource[] btlSources)
        {
            if (!isPandaInitialized)
            {
                InitializePanda();
                isPandaInitialized = true;
            }

            BTProgram program = null;

            BTLParser.Node[][] nodeSets = null;

            var cache = Fetch(btlSources);

            var exceptions = cache.exceptions;

            // A program is correct when it does not contain any exceptions.
            bool isCorrect = true;

            foreach (var ex in exceptions)
            {
                if (ex != null)
                {
                    isCorrect = false;
                    break;
                }
            }

            if (isCorrect)
            {
                nodeSets = GetBTLRoots(btlSources);
                program  = BTRuntimeBuilder.BuildProgram(nodeSets);
            }


            return(program);
        }