コード例 #1
0
ファイル: KernelCustom.cs プロジェクト: hyakugei/Zenject
        public void AddTask(ITickable task)
        {
            Assert.That(!_queuedTasks.Contains(task), "Duplicate task added to kernel with name '" + task.GetType().FullName + "'");
            Assert.That(!_tasks.Any(t => ReferenceEquals(t.Tickable, task)), "Duplicate task added to kernel with name '" + task.GetType().FullName + "'");

            // Wait until next frame to add the task, otherwise whether it gets updated
            // on the current frame depends on where in the update order it was added
            // from, so you might get off by one frame issues
            _queuedTasks.Add(task);
        }
コード例 #2
0
        public void RemoveTask(ITickable task)
        {
            var info = _sortedTasks.Concat(_unsortedTasks).Where(x => x.Tickable == task).Single();

            Assert.That(!info.IsRemoved, "Tried to remove task twice, task = " + task.GetType().Name);
            info.IsRemoved = true;
        }
コード例 #3
0
 void UpdateTickable(ITickable tickable)
 {
     using (ProfileBlock.Start("{0}.Tick()".Fmt(tickable.GetType().Name())))
     {
         tickable.Tick();
     }
 }
コード例 #4
0
ファイル: KernelCustom.cs プロジェクト: hyakugei/Zenject
        public void RemoveTask(ITickable task)
        {
            var info = _tasks.Where(i => ReferenceEquals(i.Tickable, task)).Single();

            Assert.That(!info.IsRemoved, "Tried to remove task twice, task = " + task.GetType().Name);
            info.IsRemoved = true;
        }
コード例 #5
0
        void UpdateTickable(ITickable tickable)
        {
#if PROFILING_ENABLED
            using (ProfileBlock.Start("{0}.Tick()".Fmt(tickable.GetType().Name())))
#endif
            {
                tickable.Tick();
            }
        }
コード例 #6
0
        void AddTaskInternal(ITickable task, int?priority)
        {
            Assert.That(!AllTasks.Select(x => x.Tickable).Contains(task),
                        "Duplicate task added to kernel with name '" + task.GetType().FullName + "'");

            // Wait until next frame to add the task, otherwise whether it gets updated
            // on the current frame depends on where in the update order it was added
            // from, so you might get off by one frame issues
            _queuedTasks.Add(
                new TickableInfo(task, priority));
        }
コード例 #7
0
ファイル: TickableManager.cs プロジェクト: 4xisblack/Zenject
 void UpdateTickable(ITickable tickable)
 {
     #if PROFILING_ENABLED
     using (ProfileBlock.Start("{0}.Tick()".Fmt(tickable.GetType().Name())))
     #endif
     {
         tickable.Tick();
     }
 }
コード例 #8
0
 void UpdateTickable(ITickable tickable)
 {
     using (ProfileBlock.Start("{0}.Tick()".Fmt(tickable.GetType().Name())))
     {
         tickable.Tick();
     }
 }
コード例 #9
0
ファイル: StandardKernel.cs プロジェクト: nintorii/Zenject
        public void RemoveTask(ITickable task)
        {
            var info = _sortedTasks.Concat(_unsortedTasks).Where(x => x.Tickable == task).Single();

            Assert.That(!info.IsRemoved, "Tried to remove task twice, task = " + task.GetType().Name);
            info.IsRemoved = true;
        }
コード例 #10
0
ファイル: StandardKernel.cs プロジェクト: nintorii/Zenject
        void AddTaskInternal(ITickable task, int? priority)
        {
            Assert.That(!AllTasks.Select(x => x.Tickable).Contains(task),
                "Duplicate task added to kernel with name '" + task.GetType().FullName + "'");

            // Wait until next frame to add the task, otherwise whether it gets updated
            // on the current frame depends on where in the update order it was added
            // from, so you might get off by one frame issues
            _queuedTasks.Add(
                new TickableInfo(task, priority));
        }