Пример #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);
            }
        }