示例#1
0
        public static Routine <GameObject[]> Instantiate(GameObjectFactory factory, int count,
                                                         float timePerFrame   = 0.02f,
                                                         int measureFrequency = 10)
        {
            var result  = new GameObject[count];
            var routine = new ApportionedRoutine(i =>
            {
                result[i] = factory.Build();
            }, count, timePerFrame, measureFrequency);

            return(Routine.WaitOne(routine, () => result));
        }
示例#2
0
        public static Routine <T[]> Instantiate <T>(T original, int count, float timePerFrame = 0.02f,
                                                    int measureFrequency = 10)
            where T : Object
        {
            var result  = new T[count];
            var routine = new ApportionedRoutine(i =>
            {
                result[i] = Object.Instantiate(original);
            }, count, timePerFrame, measureFrequency);

            return(Routine.WaitOne(routine, () => result));
        }