예제 #1
0
 private void OnBeforeChangeScene()
 {
     if (assetSource.canSurviveSceneChanges && !assetSource.IsSkippable())
     {
         isChangingScene = true;
     }
 }
예제 #2
0
        public static void ShowPropertiesGUI(ActionListAsset _target)
        {
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Asset properties", EditorStyles.boldLabel);
            _target.actionListType = (ActionListType)EditorGUILayout.EnumPopup("When running:", _target.actionListType);
            if (_target.actionListType == ActionListType.PauseGameplay)
            {
                _target.isSkippable        = EditorGUILayout.Toggle("Is skippable?", _target.isSkippable);
                _target.unfreezePauseMenus = EditorGUILayout.Toggle("Unfreeze 'pause' Menus?", _target.unfreezePauseMenus);
            }
            _target.canRunMultipleInstances = EditorGUILayout.Toggle("Can run multiple instances?", _target.canRunMultipleInstances);
            if (!_target.IsSkippable())
            {
                _target.canSurviveSceneChanges = EditorGUILayout.Toggle("Can survive scene changes?", _target.canSurviveSceneChanges);
            }
            _target.useParameters = EditorGUILayout.Toggle("Use parameters?", _target.useParameters);
            EditorGUILayout.EndVertical();

            if (_target.useParameters)
            {
                EditorGUILayout.Space();
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel);
                ActionListEditor.ShowParametersGUI(null, _target, _target.parameters);
                EditorGUILayout.EndVertical();
            }

            _target.tagID = ActionListEditor.ShowTagUI(_target.actions.ToArray(), _target.tagID);
        }
예제 #3
0
        public void ShowGUI()
        {
            runOnStart = EditorGUILayout.Toggle("Run on scene start?", runOnStart);
            runOnLoad  = EditorGUILayout.Toggle("Run on scene load?", runOnLoad);
            EditorGUILayout.HelpBox("The linked ActionList can also be run by invoking this script's RunActionList() method.", MessageType.Info);

            EditorGUILayout.Space();

            actionListSource = (ActionListSource)EditorGUILayout.EnumPopup("ActionList source:", actionListSource);
            switch (actionListSource)
            {
            case ActionListSource.InScene:
                actionList = (ActionList)EditorGUILayout.ObjectField("ActionList to run:", actionList, typeof(ActionList), true);

                if (actionList != null && actionList.IsSkippable())
                {
                    runInstantly = EditorGUILayout.Toggle("Run instantly?", runInstantly);
                }
                EditorGUILayout.Space();
                ShowParametersGUI(actionList);
                break;

            case ActionListSource.AssetFile:
                actionListAsset = (ActionListAsset)EditorGUILayout.ObjectField("Asset to run:", actionListAsset, typeof(ActionListAsset), false);

                if (actionListAsset != null && actionListAsset.IsSkippable())
                {
                    runInstantly = EditorGUILayout.Toggle("Run instantly?", runInstantly);
                }
                EditorGUILayout.Space();
                ShowParametersGUI(actionListAsset);
                break;
            }
        }
예제 #4
0
 protected void OnBeforeChangeScene()
 {
     if (assetSource.canSurviveSceneChanges && !assetSource.IsSkippable())
     {
         isChangingScene = true;
     }
     else
     {
         Kill();
     }
 }
예제 #5
0
 private bool IsTargetSkippable()
 {
     if (listSource == ListSource.InScene && actionList != null)
     {
         return(actionList.IsSkippable());
     }
     else if (listSource == ListSource.AssetFile && actionListAsset != null)
     {
         return(actionListAsset.IsSkippable());
     }
     return(false);
 }
예제 #6
0
        public override void Skip()
        {
            if (listSource == ListSource.InScene && actionList != null)
            {
                if (actionList.source == ActionListSource.AssetFile && actionList.assetFile != null && actionList.assetFile.useParameters)
                {
                    if (actionList.syncParamValues)
                    {
                        SendParameters(actionList.assetFile.GetParameters(), true);
                    }
                    else
                    {
                        SendParameters(actionList.parameters, false);
                    }
                }
                else if (actionList.source == ActionListSource.InScene && actionList.useParameters)
                {
                    SendParameters(actionList.parameters, false);
                }

                if (runFromStart)
                {
                    actionList.Skip();
                }
                else
                {
                    actionList.Skip(GetSkipIndex(actionList.actions));
                }
            }
            else if (listSource == ListSource.AssetFile && invActionList != null)
            {
                if (invActionList.useParameters)
                {
                    SendParameters(invActionList.GetParameters(), true);
                }

                if (runtimeActionList != null && !invActionList.IsSkippable() && invActionList.canRunMultipleInstances)
                {
                    KickStarter.actionListAssetManager.EndAssetList(runtimeActionList);
                }

                if (runFromStart)
                {
                    AdvGame.SkipActionListAsset(invActionList);
                }
                else
                {
                    AdvGame.SkipActionListAsset(invActionList, GetSkipIndex(invActionList.actions));
                }
            }
        }
예제 #7
0
        public void ShowGUI()
        {
            runOnStart = EditorGUILayout.Toggle("Run on scene start?", runOnStart);
            runOnLoad  = EditorGUILayout.Toggle("Run on scene load?", runOnLoad);

            if (runOnLoad && KickStarter.settingsManager && KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow)
            {
                sceneLoadCondition = (SceneLoadCondition)EditorGUILayout.EnumPopup("Scene load condition:", sceneLoadCondition);
            }

            EditorGUILayout.Space();

            actionListSource = (ActionListSource)EditorGUILayout.EnumPopup("ActionList source:", actionListSource);
            switch (actionListSource)
            {
            case ActionListSource.InScene:
                actionList = (ActionList)EditorGUILayout.ObjectField("ActionList to run:", actionList, typeof(ActionList), true);

                if (actionList == null && GetComponent <ActionList>())
                {
                    actionList = GetComponent <ActionList>();
                }

                if (actionList && actionList.IsSkippable())
                {
                    runInstantly = EditorGUILayout.Toggle("Run instantly?", runInstantly);
                }
                EditorGUILayout.Space();
                ShowParametersGUI(actionList);
                break;

            case ActionListSource.AssetFile:
                actionListAsset = (ActionListAsset)EditorGUILayout.ObjectField("Asset to run:", actionListAsset, typeof(ActionListAsset), false);

                if (actionListAsset && actionListAsset.IsSkippable())
                {
                    runInstantly = EditorGUILayout.Toggle("Run instantly?", runInstantly);
                }
                EditorGUILayout.Space();
                ShowParametersGUI(actionListAsset);
                break;
            }

            EditorGUILayout.Space();
            EditorGUILayout.HelpBox("The linked ActionList can also be run by invoking this script's RunActionList() method.", MessageType.Info);
        }
예제 #8
0
        /**
         * <summary>Downloads and runs the settings and Actions stored within an ActionListAsset.</summary>
         * <param name = "actionListAsset">The ActionListAsset to copy Actions from and run</param>
         * <param name = "endConversation">If set, the supplied Conversation will be run when the AcionList ends</param>
         * <param name = "i">The index number of the first Action to run</param>
         * <param name = "doSkip">If True, then the Actions will be skipped, instead of run normally</param>
         * <param name = "addToSkipQueue">If True, the ActionList will be skippable when the user presses 'EndCutscene'</param>
         * <param name = "dontRun">If True, the Actions will not be run once transferred from the ActionListAsset</param>
         */
        public void DownloadActions(ActionListAsset actionListAsset, Conversation endConversation, int i, bool doSkip, bool addToSkipQueue, bool dontRun = false)
        {
            assetSource   = actionListAsset;
            useParameters = actionListAsset.useParameters;

            parameters = new List <ActionParameter>();

            List <ActionParameter> assetParameters = actionListAsset.GetParameters();

            if (assetParameters != null)
            {
                foreach (ActionParameter assetParameter in assetParameters)
                {
                    parameters.Add(new ActionParameter(assetParameter, true));
                }
            }

            unfreezePauseMenus = actionListAsset.unfreezePauseMenus;

            actionListType = actionListAsset.actionListType;
            if (actionListAsset.actionListType == ActionListType.PauseGameplay)
            {
                isSkippable = actionListAsset.isSkippable;
            }
            else
            {
                isSkippable = false;
            }

            conversation = endConversation;
            actions.Clear();

            foreach (AC.Action action in actionListAsset.actions)
            {
                if (action != null)
                {
                    ActionEnd _lastResult = action.lastResult;

                    // Really we should re-instantiate all Actions, but this is 'safer'
                    Action newAction = (actionListAsset.canRunMultipleInstances)
                                                                                ? (Object.Instantiate(action) as Action)
                                                                                : action;

                    if (doSkip)
                    {
                        newAction.lastResult = _lastResult;
                    }

                    actions.Add(newAction);
                }
                else
                {
                    actions.Add(null);
                }
            }

            /*if (!useParameters)
             * {
             *      foreach (Action action in actions)
             *      {
             *              action.AssignValues (null);
             *      }
             * }*/

            actionListAsset.AfterDownloading();


            if (!dontRun)
            {
                if (doSkip)
                {
                    Skip(i);
                }
                else
                {
                    Interact(i, addToSkipQueue);
                }
            }

            if (actionListAsset.canSurviveSceneChanges && !actionListAsset.IsSkippable())
            {
                DontDestroyOnLoad(gameObject);
            }
        }
예제 #9
0
        private void RunActionLists()
        {
            switch (actionListSource)
            {
            case ActionListSource.InScene:
                if (actionList != null)
                {
                    if (setParameters)
                    {
                        AssignParameterValues(actionList);
                    }

                    if (actionList.IsSkippable() && runInstantly)
                    {
                        actionList.Skip();
                    }
                    else
                    {
                        actionList.Interact();
                    }
                }
                break;

            case ActionListSource.AssetFile:
                if (actionListAsset != null)
                {
                    if (setParameters && runMultipleTimes)
                    {
                        if (actionListAsset.canRunMultipleInstances)
                        {
                            for (int i = 0; i < successiveGUIData.Length + 1; i++)
                            {
                                AssignParameterValues(actionListAsset, i);

                                if (actionListAsset.IsSkippable() && runInstantly)
                                {
                                    AdvGame.SkipActionListAsset(actionListAsset);
                                }
                                else
                                {
                                    actionListAsset.Interact();
                                }
                            }
                        }
                        else
                        {
                            ACDebug.LogWarning("Cannot set run multiple parameter configurations because the ActionList asset '" + actionListAsset + "' has 'Can run multiple instances?' unchecked.", actionListAsset);
                        }
                        return;
                    }

                    if (setParameters)
                    {
                        AssignParameterValues(actionListAsset);
                    }

                    if (actionListAsset.IsSkippable() && runInstantly)
                    {
                        AdvGame.SkipActionListAsset(actionListAsset);
                    }
                    else
                    {
                        actionListAsset.Interact();
                    }
                }
                break;
            }
        }
예제 #10
0
        /**
         * <summary>Downloads and runs the settings and Actions stored within an ActionListAsset.</summary>
         * <param name = "actionListAsset">The ActionListAsset to copy Actions from and run</param>
         * <param name = "endConversation">If set, the supplied Conversation will be run when the AcionList ends</param>
         * <param name = "i">The index number of the first Action to run</param>
         * <param name = "doSkip">If True, then the Actions will be skipped, instead of run normally</param>
         * <param name = "addToSkipQueue">If True, the ActionList will be skippable when the user presses 'EndCutscene'</param>
         * <param name = "dontRun">If True, the Actions will not be run once transferred from the ActionListAsset</param>
         */
        public void DownloadActions(ActionListAsset actionListAsset, Conversation endConversation, int i, bool doSkip, bool addToSkipQueue, bool dontRun = false)
        {
            assetSource   = actionListAsset;
            useParameters = actionListAsset.useParameters;

            parameters = new List <ActionParameter>();
            if (useParameters && actionListAsset.parameters != null)
            {
                foreach (ActionParameter assetParameter in actionListAsset.parameters)
                {
                    parameters.Add(new ActionParameter(assetParameter, true));
                }
            }

            unfreezePauseMenus = actionListAsset.unfreezePauseMenus;

            actionListType = actionListAsset.actionListType;
            if (actionListAsset.actionListType == ActionListType.PauseGameplay)
            {
                isSkippable = actionListAsset.isSkippable;
            }
            else
            {
                isSkippable = false;
            }

            conversation = endConversation;
            actions.Clear();

            foreach (AC.Action action in actionListAsset.actions)
            {
                ActionEnd _lastResult = action.lastResult;

                actions.Add(action);

                if (doSkip && action != null)
                {
                    actions[actions.Count - 1].lastResult = _lastResult;
                }
            }

            if (!useParameters)
            {
                foreach (Action action in actions)
                {
                    action.AssignValues(null);
                }
            }

            if (!dontRun)
            {
                if (doSkip)
                {
                    Skip(i);
                }
                else
                {
                    Interact(i, addToSkipQueue);
                }
            }

            if (actionListAsset.canSurviveSceneChanges && !actionListAsset.IsSkippable())
            {
                DontDestroyOnLoad(gameObject);
            }
        }