コード例 #1
0
ファイル: ObjectRoutine.cs プロジェクト: Hengle/omega-package
        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
ファイル: ObjectRoutine.cs プロジェクト: Hengle/omega-package
        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));
        }