예제 #1
0
        private IEnumerator RunAction(Action action)
        {
            if (useParameters)
            {
                action.AssignValues(parameters);
            }
            else
            {
                action.AssignValues(null);
            }

            if (isSkipping)
            {
                action.Skip();
            }
            else
            {
                if (action is ActionRunActionList)
                {
                    ActionRunActionList actionRunActionList = (ActionRunActionList)action;
                    actionRunActionList.isSkippable = IsSkippable();
                }

                action.isRunning = false;
                float waitTime = action.Run();

                if (action is ActionParallel)
                {
                }
                else if (waitTime > 0f)
                {
                    while (action.isRunning)
                    {
                        if (this is RuntimeActionList && actionListType == ActionListType.PauseGameplay && !unfreezePauseMenus)
                        {
                            float endTime = Time.realtimeSinceStartup + waitTime;
                            while (Time.realtimeSinceStartup < endTime)
                            {
                                yield return(null);
                            }
                        }
                        else
                        {
                            yield return(new WaitForSeconds(waitTime));
                        }

                        waitTime = action.Run();
                    }
                }
            }

            if (action is ActionParallel)
            {
                EndActionParallel((ActionParallel)action);
            }
            else
            {
                EndAction(action);
            }
        }
예제 #2
0
        private IEnumerator RunAction(Action action)
        {
            action.AssignParentList(this);
            if (useParameters)
            {
                action.AssignValues(parameters);
            }
            else
            {
                action.AssignValues(null);
            }

            if (isSkipping)
            {
                skipIteractions++;
                action.Skip();
            }
            else
            {
                if (action is ActionRunActionList)
                {
                    ActionRunActionList actionRunActionList = (ActionRunActionList)action;
                    actionRunActionList.isSkippable = IsSkippable();
                }

                action.isRunning = false;
                float waitTime = action.Run();

                if (KickStarter.settingsManager.printActionCommentsInConsole)
                {
                    action.PrintComment(this);
                }

                if (action is ActionParallel)
                {
                }
                else if (waitTime != 0f)
                {
                    while (action.isRunning)
                    {
                        bool runInRealtime = (this is RuntimeActionList && actionListType == ActionListType.PauseGameplay && !unfreezePauseMenus && KickStarter.playerMenus.ArePauseMenusOn(null));

                        if (waitTime < 0)
                        {
                            //yield return new WaitForEndOfFrame (); // OLD

                            if (!runInRealtime && Time.timeScale == 0f)
                            {
                                while (Time.timeScale == 0f)
                                {
                                    yield return(new WaitForEndOfFrame());
                                }
                            }
                            else
                            {
                                yield return(new WaitForEndOfFrame());
                            }
                        }
                        else if (runInRealtime)
                        {
                            float endTime = Time.realtimeSinceStartup + waitTime;
                            while (Time.realtimeSinceStartup < endTime)
                            {
                                yield return(null);
                            }
                        }
                        else
                        {
                            yield return(new WaitForSeconds(waitTime));
                        }

                        if (!action.isRunning)
                        {
                            // In rare cases (once an actionlist is reset) isRunning may be false but this while loop will still run
                            ResetList();
                            break;
                        }

                        waitTime = action.Run();
                    }
                }
            }

            if (action is ActionParallel)
            {
                EndActionParallel((ActionParallel)action);
            }
            else
            {
                EndAction(action);
            }
        }
예제 #3
0
        private IEnumerator RunAction(Action action)
        {
            action.AssignParentList(this);
            if (useParameters)
            {
                action.AssignValues(parameters);
            }
            else
            {
                action.AssignValues(null);
            }

            if (isSkipping)
            {
                skipIteractions++;
                action.Skip();
            }
            else
            {
                if (action is ActionRunActionList)
                {
                    ActionRunActionList actionRunActionList = (ActionRunActionList)action;
                    actionRunActionList.isSkippable = IsSkippable();
                }

                action.isRunning = false;
                float waitTime = action.Run();

                if (action is ActionParallel)
                {
                }
                else if (waitTime != 0f)
                {
                    while (action.isRunning)
                    {
                        if (this is RuntimeActionList && actionListType == ActionListType.PauseGameplay && !unfreezePauseMenus)
                        {
                            float endTime = Time.realtimeSinceStartup + waitTime;
                            while (Time.realtimeSinceStartup < endTime)
                            {
                                yield return(null);
                            }
                        }
                        else
                        {
                            yield return(new WaitForSeconds(waitTime));
                        }

                        if (!action.isRunning)
                        {
                            // In rare cases (once an actionlist is reset) isRunning may be false but this while loop will still run
                            ResetList();
                            break;
                        }
                        waitTime = action.Run();
                    }
                }
            }

            if (action is ActionParallel)
            {
                EndActionParallel((ActionParallel)action);
            }
            else
            {
                EndAction(action);
            }
        }
예제 #4
0
        private IEnumerator RunAction(Action action)
        {
            action.AssignParentList(this);
            if (useParameters)
            {
                action.AssignValues(parameters);
            }
            else
            {
                action.AssignValues(null);
            }

            if (isSkipping)
            {
                skipIteractions++;
                action.Skip();

                if (KickStarter.settingsManager.printActionCommentsInConsole)
                {
                    action.PrintComment(this);
                }
            }
            else
            {
                if (action is ActionRunActionList)
                {
                    ActionRunActionList actionRunActionList = (ActionRunActionList)action;
                    actionRunActionList.isSkippable = IsSkippable();
                }

                if (isChangingScene)
                {
                    ACDebug.Log("Cannot begin Action #" + actions.IndexOf(action) + " " + action.category + ": " + action.title + " in list " + gameObject.name + " while changing scene, will resume once loading is complete.", this);
                    while (isChangingScene)
                    {
                        yield return(null);
                    }
                }

                action.isRunning = false;
                float waitTime = action.Run();

                if (KickStarter.settingsManager.printActionCommentsInConsole)
                {
                    action.PrintComment(this);
                }

                if (action is ActionParallel)
                {
                }
                else if (!Mathf.Approximately(waitTime, 0f))
                {
                    while (action.isRunning)
                    {
                        bool runInRealtime = (this is RuntimeActionList && actionListType == ActionListType.PauseGameplay && !unfreezePauseMenus && KickStarter.playerMenus.ArePauseMenusOn(null));

                        if (isChangingScene)
                        {
                            ACDebug.Log("Cannot continue Action #" + actions.IndexOf(action) + " " + action.category + ": " + action.title + " in list " + gameObject.name + " while changing scene, will resume once loading is complete.", this);
                            while (isChangingScene)
                            {
                                yield return(null);
                            }
                        }

                        if (waitTime < 0)
                        {
                            if (!runInRealtime && Time.timeScale <= 0f)
                            {
                                while (Time.timeScale <= 0f)
                                {
                                    yield return(new WaitForEndOfFrame());
                                }
                            }
                            else
                            {
                                yield return(new WaitForEndOfFrame());
                            }
                        }
                        else if (runInRealtime)
                        {
                            float endTime = Time.realtimeSinceStartup + waitTime;
                            while (Time.realtimeSinceStartup < endTime)
                            {
                                yield return(null);
                            }
                        }
                        else
                        {
                            yield return(new WaitForSeconds(waitTime));
                        }

                        if (!action.isRunning)
                        {
                            // In rare cases (once an actionlist is reset) isRunning may be false but this while loop will still run
                            ResetList();
                            break;
                        }

                        waitTime = action.Run();
                    }
                }
            }

            if (action is ActionParallel)
            {
                EndActionParallel((ActionParallel)action);
            }
            else
            {
                EndAction(action);
            }
        }
예제 #5
0
        /**
         * <summary>Resumes the ActionList.</summary>
         * <param name = "_startIndex">The Action index that the ActionList was originally started from.</param>
         * <param name = "_resumeIndices">An array of Action indices to resume from</param>
         * <param name = "_parameterData">The ActionParameter values when paused, as a serializable string</param>
         * <param name = "rerunPreviousAction">If True, then any Actions that were running when the ActionList was paused will be re-run</param>
         */
        public void Resume(int _startIndex, int[] _resumeIndices, string _parameterData, bool rerunPreviousAction = false)
        {
            resumeIndices.Clear();
            foreach (int resumeIndex in _resumeIndices)
            {
                resumeIndices.Add(resumeIndex);
            }

            if (resumeIndices.Count > 0)
            {
                ResetList();
                ResetSkips();

                SetParameterData(_parameterData);

                pauseWhenActionFinishes = false;

                if (KickStarter.actionListManager == null)
                {
                    ACDebug.LogWarning("Cannot run " + this.name + " because no ActionListManager was found.", gameObject);
                    return;
                }

                AddResumeToManager(_startIndex);

                KickStarter.eventManager.Call_OnResumeActionList(this);

                foreach (int resumeIndex in resumeIndices)
                {
                    if (resumeIndex >= 0 && resumeIndex < actions.Count)
                    {
                        if (rerunPreviousAction)
                        {
                            ProcessAction(resumeIndex);
                        }
                        else
                        {
                            Action action = actions[resumeIndex];

                            if (useParameters)
                            {
                                action.AssignValues(parameters);
                            }
                            else
                            {
                                action.AssignValues(null);
                            }

                            if (action is ActionParallel)
                            {
                                EndActionParallel((ActionParallel)action);
                            }
                            else
                            {
                                EndAction(action);
                            }
                        }
                    }
                }
            }
            else
            {
                Kill();
                Interact();
            }
        }