コード例 #1
0
ファイル: InputBuilder.cs プロジェクト: zhu1987/critterai
        private InputBuilder(InputBuildContext context, IInputBuildProcessor[] processors)
        {
            mContext         = context;
            mInputProcessors = processors;

            System.Array.Sort(mInputProcessors, new PriorityComparer <IInputBuildProcessor>(true));

            mState = InputBuildState.LoadComponents;
        }
コード例 #2
0
ファイル: InputBuilder.cs プロジェクト: zhu1987/critterai
        public static InputBuilder Create(ISceneQuery filter
                                          , IInputBuildProcessor[] processors
                                          , InputBuildOption options)
        {
            IInputBuildProcessor[] lprocessors = ArrayUtil.Compress(processors);

            if (lprocessors == null || lprocessors.Length == 0)
            {
                return(null);
            }

            for (int i = lprocessors.Length - 1; i >= 0; i--)
            {
                IInputBuildProcessor processor = lprocessors[i];

                if (processor.DuplicatesAllowed)
                {
                    continue;
                }

                System.Type ta = processor.GetType();

                for (int j = i - 1; j >= 0; j--)
                {
                    System.Type tb = lprocessors[j].GetType();

                    if (ta.IsAssignableFrom(tb) || tb.IsAssignableFrom(ta))
                    {
                        return(null);
                    }
                }
            }

            if (lprocessors == processors)
            {
                lprocessors = (IInputBuildProcessor[])lprocessors.Clone();
            }

            InputBuildContext context = new InputBuildContext(filter, options);

            return(new InputBuilder(context, lprocessors));
        }