Example #1
0
        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);
        }
Example #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;
        }
Example #3
0
 void UpdateTickable(ITickable tickable)
 {
     using (ProfileBlock.Start("{0}.Tick()".Fmt(tickable.GetType().Name())))
     {
         tickable.Tick();
     }
 }
Example #4
0
        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;
        }
Example #5
0
        void UpdateTickable(ITickable tickable)
        {
#if PROFILING_ENABLED
            using (ProfileBlock.Start("{0}.Tick()".Fmt(tickable.GetType().Name())))
#endif
            {
                tickable.Tick();
            }
        }
Example #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));
        }
Example #7
0
 void UpdateTickable(ITickable tickable)
 {
     #if PROFILING_ENABLED
     using (ProfileBlock.Start("{0}.Tick()".Fmt(tickable.GetType().Name())))
     #endif
     {
         tickable.Tick();
     }
 }
Example #8
0
 void UpdateTickable(ITickable tickable)
 {
     using (ProfileBlock.Start("{0}.Tick()".Fmt(tickable.GetType().Name())))
     {
         tickable.Tick();
     }
 }
Example #9
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;
        }
Example #10
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));
        }