コード例 #1
0
 /// <summary>
 /// Resumes every job tagged with 'tag(s)'.
 /// </summary>
 /// <param name="tag">The tag(s) of the jobs to be resumed.</param>
 public static void Resume(params string[] tags)
 {
     for (int i = 0; i < tags.Length; i++)
     {
         ScheduleBridge.Resume(SuperInvokeTag.GetInstance(tags[i]));
     }
 }
コード例 #2
0
        private IJob ScheduleSequence(object repeatOpt = null)
        {
            IJob job = null;

            Sequence sequence = Sequence.MakeInstance();

            sequence.SetGroupTag(superInvokeTag);

            float seqDelay = 0;

            if (thereIsSequenceDelayToAdd)
            {
                seqDelay = sequenceDelayToAdd;
                thereIsSequenceDelayToAdd = false;
            }

            for (int i = 0; i < tasks.Count; i++)
            {
                DelayedTask t          = tasks[i];
                SingleTask  singleTask = SingleTask.MakeInstance(t.Method, seqDelay + t.DelayTime, null);
                seqDelay = 0;
                sequence.AddSingleTask(singleTask);
            }


            if (thereIsDelayToAdd)
            {
                SingleTask singleTask = SingleTask.MakeInstance(delegate {}, seqDelay + delayToAdd, null);
                sequence.AddSingleTask(singleTask);
            }
            else if (tasks.Count == 0)
            {
                SingleTask singleTask = SingleTask.MakeInstance(delegate {}, seqDelay, null);
                sequence.AddSingleTask(singleTask);
            }

            if (repeatOpt != null)
            {
                RepeatSettings repeatSettings = (RepeatSettings)repeatOpt;
                JobRepeat      jobRepeat      = new JobRepeat()
                {
                    TotalRepeatsNumber = repeatSettings.repeats
                };

                sequence.SetIterativeMode(repeatSettings);

                job = jobRepeat;
            }
            else
            {
                job = new Job();
            }

            sequence.SetJob(job);
            ScheduleBridge.Schedule(sequence);

            ResetStuff();

            return(job);
        }
コード例 #3
0
        private static IJobRepeat ActualRunRepeat(Action method, string tag, RepeatSettings repeatSettings)
        {
            CheckMethod(method);
            CheckDelay(repeatSettings.delay);

            JobRepeat jobRepeat = null;

            if (repeatSettings.repeats == INFINITY || repeatSettings.repeats > 0)                   //if repeats == 0 it does nothing

            {
                jobRepeat = new JobRepeat()
                {
                    TotalRepeatsNumber = repeatSettings.repeats
                };

                Sequence sequence = Sequence.MakeInstance();
                sequence.SetGroupTag(SuperInvokeTag.GetInstance(tag));
                sequence.AddSingleTask(SingleTask.MakeInstance(method, 0, tag));
                sequence.SetIterativeMode(repeatSettings);
                sequence.SetJob(jobRepeat);

                ScheduleBridge.Schedule(sequence);
            }

            return(jobRepeat);
        }
コード例 #4
0
 private void OnDestroy()
 {
     if (ScheduleBridge.IsManagerAlive())
     {
         foreach (Job superInvokeTask in killOnDestroySet)
         {
             superInvokeTask.Kill();
         }
     }
 }
コード例 #5
0
 private void OnDisable()
 {
     if (ScheduleBridge.IsManagerAlive())
     {
         foreach (Job superInvokeTask in pauseOnDisableSet)
         {
             superInvokeTask.Pause();
         }
     }
 }
コード例 #6
0
 private void OnEnable()
 {
     if (ScheduleBridge.IsManagerAlive())
     {
         foreach (Job superInvokeTask in resumeOnEnableSet)
         {
             superInvokeTask.Resume();
         }
     }
 }
コード例 #7
0
        /// <summary>
        /// Kills every job except those tagged with 'tag(s)'.
        /// </summary>
        /// <param name="tags">The tag(s) of the jobs that must remain alive.</param>
        public static void KillAllExcept(params string[] tags)
        {
            List <SuperInvokeTag> tagList = new List <SuperInvokeTag>();

            foreach (var tag in tags)
            {
                tagList.Add(SuperInvokeTag.GetInstance(tag));
            }
            ScheduleBridge.KillAllExcept(tagList.ToArray());
        }
コード例 #8
0
        private static IJob ActualRun(Action method, float delay, string tag)
        {
            CheckMethod(method);
            CheckDelay(delay);

            Job job = new Job();
            ISuperInvokeRunnable runnable = SingleTask.MakeInstance(method, delay, tag);

            runnable.SetJob(job);

            ScheduleBridge.Schedule(runnable);
            return(job);
        }
コード例 #9
0
        /// <summary>
        /// Executes a method after 'frames' frame.
        /// </summary>
        /// <param name="frames">The number of frames to skip.</param>
        /// <param name="method">Actual code to execute.</param>
        public static void SkipFrames(int frames, Action method)
        {
            CheckMethod(method);

            if (frames < 0)
            {
                throw new ArgumentException("Argument 'frames' cannot be less than 0.");
            }

            if (frames == 0)
            {
                method.Invoke();
            }
            else
            {
                ScheduleBridge.SkipFrames(frames, method);
            }
        }
コード例 #10
0
 /// <summary>
 /// Executes a method after one frame.
 /// </summary>
 /// <param name="method">Actual code to execute.</param>
 public static void SkipFrame(Action method)
 {
     ScheduleBridge.SkipFrames(1, method);
 }
コード例 #11
0
 /// <summary>
 /// Optional initialization method.
 /// If never called SuperInvoke will be automatically initialized on its first usage.
 /// </summary>
 /// <param name="dontDestroyOnLoad">Sets "DontDestroyOnLoad" on the SuperInvoke manager game object.</param>
 public static void Init(bool dontDestroyOnLoad = true)
 {
     ScheduleBridge.Init(dontDestroyOnLoad);
 }
コード例 #12
0
 /// <summary>
 /// Kills every job currently scheduled or paused in the project.
 /// Any sequence in execution will immediately stop its execution.
 /// Any repeated job will stop its execution and will not be repeated anymore.
 /// </summary>
 public static void KillAll()
 {
     ScheduleBridge.KillAll();
 }
コード例 #13
0
 public void Kill()
 {
     ScheduleBridge.Kill(Tag);
 }
コード例 #14
0
 public void Resume()
 {
     ScheduleBridge.Resume(Tag);
 }
コード例 #15
0
 public void Pause()
 {
     ScheduleBridge.Pause(Tag);
 }