Example #1
0
        public override void OnInspectorGUI()
        {
            RuntimeActionList _target = (RuntimeActionList)target;

            if (Application.isPlaying)
            {
                CustomGUILayout.BeginVertical();
                EditorGUILayout.ObjectField("Asset source:", _target.assetSource, typeof(ActionListAsset), false);

                if (_target.useParameters)
                {
                    CustomGUILayout.EndVertical();
                    CustomGUILayout.BeginVertical();
                    EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel);
                    ActionListEditor.ShowParametersGUI(_target, null, _target.parameters);
                }
                CustomGUILayout.EndVertical();
            }
            else
            {
                EditorGUILayout.HelpBox("This component should not be added manually - it is added automatically by AC at runtime.", MessageType.Warning);
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Example #2
0
        /**
         * <summary>A Constructor</summary>
         * <param name = "_actionList">The ActionList that this class will store data for</param>
         * <param name = "_inSkipQueue">Whether or not the ActionList will be skipped when 'EndCutscene' is triggered</param>
         * <param name = "_startIndex">The index of Actions within the ActionList that it starts from when run</param>
         */
        public ActiveList(ActionList _actionList, bool _inSkipQueue, int _startIndex)
        {
            actionList = _actionList;

            if (actionList.conversation)
            {
                conversationOnEnd = actionList.conversation;
            }

            RuntimeActionList runtimeActionList = actionList as RuntimeActionList;

            if (runtimeActionList != null)
            {
                actionListAsset = runtimeActionList.assetSource;
            }
            else
            {
                actionListAsset = null;
            }

            inSkipQueue   = _inSkipQueue;
            startIndex    = _startIndex;
            isRunning     = true;
            resumeIndices = new int[0];
            parameterData = string.Empty;
            timeStarted   = Time.time;
        }
        /**
         * <summary>Adds a new ActionListAsset, assumed to already be running, to the internal record of currently-running ActionListAssets, and sets the correct GameState in StateHandler.</summary>
         * <param name = "runtimeActionList">The RuntimeActionList associated with the ActionListAsset to run</param>
         * <param name = "actionListAsset">The ActionListAsset that is the runtimeActionList's source, if it has one.</param>
         * <param name = "addToSkipQueue">If True, then the ActionList will be added to the list of ActionLists to skip</param>
         * <param name = "_startIndex">The index number of the Action to start skipping from, if addToSkipQueue = True</param>
         */
        public void AddToList(RuntimeActionList runtimeActionList, ActionListAsset actionListAsset, bool addToSkipQueue, int _startIndex)
        {
            if (!actionListAsset.canRunMultipleInstances)
            {
                for (int i = 0; i < activeLists.Count; i++)
                {
                    if (activeLists[i].IsFor(actionListAsset))
                    {
                        activeLists.RemoveAt(i);
                    }
                }
            }

            addToSkipQueue = KickStarter.actionListManager.CanAddToSkipQueue(runtimeActionList, addToSkipQueue);
            activeLists.Add(new ActiveList(runtimeActionList, addToSkipQueue, _startIndex));

            if (KickStarter.playerMenus.ArePauseMenusOn(null))
            {
                if (runtimeActionList.actionListType == ActionListType.RunInBackground)
                {
                    // Don't change gamestate if running in background
                    return;
                }
                if (runtimeActionList.actionListType == ActionListType.PauseGameplay && !runtimeActionList.unfreezePauseMenus)
                {
                    // Don't affect the gamestate if we want to remain frozen
                    return;
                }
            }
            KickStarter.actionListManager.SetCorrectGameState();
        }
Example #4
0
        public bool CanResetSkipVars(ActionList actionList)
        {
            if (actionList is RuntimeActionList)
            {
                RuntimeActionList runtimeActionList = (RuntimeActionList)actionList;
                foreach (ActiveList activeList in KickStarter.actionListAssetManager.activeLists)
                {
                    if (activeList.IsFor(runtimeActionList))
                    {
                        return(activeList.CanResetSkipVars());
                    }
                    if (activeList.IsFor(runtimeActionList.assetSource))
                    {
                        return(activeList.CanResetSkipVars());
                    }
                }
                return(true);
            }

            foreach (ActiveList activeList in activeLists)
            {
                if (activeList.IsFor(actionList))
                {
                    return(activeList.CanResetSkipVars());
                }
            }

            return(true);
        }
Example #5
0
        public bool IsListRegistered(ActionList actionList)
        {
            if (actionList == null)
            {
                return(false);
            }

            RuntimeActionList runtimeActionList = actionList as RuntimeActionList;

            if (runtimeActionList != null)
            {
                foreach (ActiveList activeList in KickStarter.actionListAssetManager.activeLists)
                {
                    if (activeList.IsFor(runtimeActionList))
                    {
                        return(true);
                    }
                }
                return(false);
            }

            foreach (ActiveList activeList in activeLists)
            {
                if (activeList.IsFor(actionList))
                {
                    return(true);
                }
            }

            return(false);
        }
        /**
         * <summary>Checks if a particular ActionList is running.</summary>
         * <param name = "actionList">The ActionList to search for</param>
         * <returns>True if the ActionList is currently running</returns>
         */
        public bool IsListRunning(ActionList actionList)
        {
            if (actionList is RuntimeActionList)
            {
                RuntimeActionList runtimeActionList = (RuntimeActionList)actionList;
                foreach (ActiveList activeList in KickStarter.actionListAssetManager.activeLists)
                {
                    if (activeList.IsFor(runtimeActionList) && activeList.IsRunning())
                    {
                        return(true);
                    }
                }
                return(false);
            }

            foreach (ActiveList activeList in activeLists)
            {
                if (activeList.IsFor(actionList) && activeList.IsRunning())
                {
                    return(true);
                }
            }

            return(false);
        }
Example #7
0
        /**
         * <summary>A Constructor</summary>
         * <param name = "_actionList">The ActionList that this class will store data for</param>
         * <param name = "_inSkipQueue">Whether or not the ActionList will be skipped when 'EndCutscene' is triggered</param>
         * <param name = "_startIndex">The index of Actions within the ActionList that it starts from when run</param>
         */
        public ActiveList(ActionList _actionList, bool _inSkipQueue, int _startIndex)
        {
            actionList = _actionList;

            if (actionList.conversation)
            {
                conversationOnEnd = actionList.conversation;
            }

            if (actionList is RuntimeActionList)
            {
                RuntimeActionList runtimeActionList = (RuntimeActionList)actionList;
                actionListAsset = runtimeActionList.assetSource;
            }
            else
            {
                actionListAsset = null;
            }

            inSkipQueue   = _inSkipQueue;
            startIndex    = _startIndex;
            isRunning     = true;
            resumeIndices = new int[0];
            parameterData = "";
        }
Example #8
0
        /**
         * <summary>A Constructor</summary>
         * <param name = "_actionList">The ActionList that this class will store data for</param>
         * <param name = "_inSkipQueue">Whether or not the ActionList will be skipped when 'EndCutscene' is triggered</param>
         * <param name = "_startIndex">The index of Actions within the ActionList that it starts from when run</param>
         */
        public ActiveList(ActionList _actionList, bool _inSkipQueue, int _startIndex)
        {
            actionList = _actionList;

            if (actionList.conversation)
            {
                conversationOnEnd = actionList.conversation;
            }

            RuntimeActionList runtimeActionList = actionList as RuntimeActionList;

            if (runtimeActionList != null)
            {
                actionListAsset = runtimeActionList.assetSource;
            }
            else
            {
                actionListAsset = null;
            }

            inSkipQueue           = _inSkipQueue;
            startIndex            = _startIndex;
            isRunning             = true;
            resumeIndices         = new int[0];
            parameterData         = string.Empty;
            gamePausedWhenStarted = (KickStarter.stateHandler != null) ? KickStarter.stateHandler.IsPaused() : false;
        }
Example #9
0
        public void EndList(ActionList _list)
        {
            if (IsListRunning(_list))
            {
                activeLists.Remove(_list);
            }

            _list.Reset();

            if (_list.conversation == conversationOnEnd && _list.conversation != null)
            {
                if (KickStarter.stateHandler)
                {
                    KickStarter.stateHandler.gameState = GameState.Cutscene;
                }
                else
                {
                    Debug.LogWarning("Could not set correct GameState!");
                }

                ResetSkipVars();
                conversationOnEnd.Interact();
                conversationOnEnd = null;
            }
            else
            {
                if (_list is RuntimeActionList && _list.actionListType == ActionListType.PauseGameplay && !_list.unfreezePauseMenus && KickStarter.playerMenus.ArePauseMenusOn(null))
                {
                    // Don't affect the gamestate if we want to remain frozen
                    if (KickStarter.stateHandler.gameState != GameState.Cutscene)
                    {
                        ResetSkipVars();
                    }
                }
                else
                {
                    SetCorrectGameStateEnd();
                }
            }

            if (_list.autosaveAfter)
            {
                if (!IsGameplayBlocked())
                {
                    SaveSystem.SaveAutoSave();
                }
                else
                {
                    saveAfterCutscene = true;
                }
            }

            if (_list is RuntimeActionList)
            {
                RuntimeActionList runtimeActionList = (RuntimeActionList)_list;
                runtimeActionList.DestroySelf();
            }
        }
Example #10
0
 /**
  * <summary>Stops an ActionListAsset from running.</summary>
  * <param name = "runtimeActionList">The RuntimeActionList associated with the ActionListAsset file to stop></param>
  */
 public void EndAssetList(RuntimeActionList runtimeActionList)
 {
     for (int i = 0; i < activeLists.Count; i++)
     {
         if (activeLists[i].IsFor(runtimeActionList))
         {
             KickStarter.actionListManager.EndList(activeLists[i]);
             return;
         }
     }
 }
Example #11
0
        public static RuntimeActionList RunActionListAsset(ActionListAsset actionListAsset, Conversation endConversation, int i, bool doSkip, bool addToSkipQueue)
        {
            if (actionListAsset != null && actionListAsset.actions.Count > 0)
            {
                GameObject        runtimeActionListObject = (GameObject)Instantiate(Resources.Load(Resource.runtimeActionList));
                RuntimeActionList runtimeActionList       = runtimeActionListObject.GetComponent <RuntimeActionList>();
                runtimeActionList.DownloadActions(actionListAsset, endConversation, i, doSkip, addToSkipQueue);
                return(runtimeActionList);
            }

            return(null);
        }
Example #12
0
 /**
  * <summary>Resumes the associated ActionList, if it had previously been paused.</summary>
  * <param name = "runtimeActionList">The RuntimeActionList to re-associate the class with</param>
  * <param name = "rerunPausedActions">If True, then any Actions that were midway-through running when the ActionList was paused will be restarted. Otherwise, the Actions that follow them will be reun instead.</param>
  */
 public void Resume(RuntimeActionList runtimeActionList = null, bool rerunPausedActions = false)
 {
     if (runtimeActionList != null)
     {
         actionList = runtimeActionList;
         runtimeActionList.Resume(startIndex, resumeIndices, parameterData, rerunPausedActions);
     }
     else
     {
         actionList.Resume(startIndex, resumeIndices, parameterData, rerunPausedActions);
     }
 }
Example #13
0
 /**
  * <summary>Resumes the associated ActionList, if it had previously been paused.</summary>
  * <param name = "runtimeActionList">The RuntimeActionList to re-associate the class with</param>
  */
 public void Resume(RuntimeActionList runtimeActionList = null)
 {
     if (runtimeActionList != null)
     {
         actionList = runtimeActionList;
         runtimeActionList.Resume(startIndex, resumeIndices, parameterData);
     }
     else
     {
         actionList.Resume(startIndex, resumeIndices, parameterData);
     }
 }
Example #14
0
 /**
  * <summary>Pauses an ActionListAsset, provided that it is currently running.</summary>
  * <param name = "actionListAsset">The ActionListAsset to pause</param>
  * <returns>The RuntimeActionList that is in the scene, associated with the ActionListAsset</returns>
  */
 public RuntimeActionList Pause(ActionListAsset actionListAsset)
 {
     for (int i = 0; i < activeLists.Count; i++)
     {
         if (activeLists[i].IsFor(actionListAsset))
         {
             RuntimeActionList runtimeActionList = (RuntimeActionList)activeLists[i].actionList;
             runtimeActionList.Pause();
             return(runtimeActionList);
         }
     }
     return(null);
 }
Example #15
0
        /**
         * <summary>Resumes the associated ActionList, if it had previously been paused.</summary>
         * <param name = "runtimeActionList">The RuntimeActionList to re-associate the class with</param>
         * <param name = "rerunPausedActions">If True, then any Actions that were midway-through running when the ActionList was paused will be restarted. Otherwise, the Actions that follow them will be reun instead.</param>
         */
        public void Resume(RuntimeActionList runtimeActionList = null, bool rerunPausedActions = false)
        {
            if (runtimeActionList != null)
            {
                actionList = runtimeActionList;
                runtimeActionList.Resume(startIndex, resumeIndices, parameterData, rerunPausedActions);
            }
            else
            {
                actionList.Resume(startIndex, resumeIndices, parameterData, rerunPausedActions);
            }

            gamePausedWhenStarted = (KickStarter.stateHandler != null) ? KickStarter.stateHandler.IsPaused() : false;
        }
Example #16
0
        /**
         * <summary>Pauses an ActionListAsset, provided that it is currently running.</summary>
         * <param name = "actionListAsset">The ActionListAsset to pause</param>
         * <returns>All RuntimeActionLists that are in the scene, associated with the ActionListAsset</returns>
         */
        public RuntimeActionList[] Pause(ActionListAsset actionListAsset)
        {
            List <RuntimeActionList> runtimeActionLists = new List <RuntimeActionList>();

            for (int i = 0; i < activeLists.Count; i++)
            {
                if (activeLists[i].IsFor(actionListAsset))
                {
                    RuntimeActionList runtimeActionList = (RuntimeActionList)activeLists[i].actionList;
                    runtimeActionList.Pause();
                    runtimeActionLists.Add(runtimeActionList);
                }
            }
            return(runtimeActionLists.ToArray());
        }
Example #17
0
        public SkipList(ActionList _actionList, int _startIndex)
        {
            actionList = _actionList;
            startIndex = _startIndex;

            if (_actionList is RuntimeActionList)
            {
                RuntimeActionList runtimeActionList = (RuntimeActionList)_actionList;
                actionListAsset = runtimeActionList.assetSource;
            }
            else
            {
                actionListAsset = null;
            }
        }
Example #18
0
        /**
         * Ends all currently-running ActionLists and ActionListAssets.
         */
        public void KillAllLists()
        {
            foreach (ActionList _list in activeLists)
            {
                _list.ResetList();

                if (_list is RuntimeActionList)
                {
                    RuntimeActionList runtimeActionList = (RuntimeActionList)_list;
                    runtimeActionList.DestroySelf();
                }
            }

            activeLists.Clear();
        }
        /**
         * <summary>Resumes a previously-paused ActionListAsset. If the ActionListAsset is already running, nothing will happen.</summary>
         * <param name = "actionListAsset">The ActionListAsset to pause</param>
         * <param name = "rerunPausedActions">If True, then any Actions that were midway-through running when the ActionList was paused will be restarted. Otherwise, the Actions that follow them will be reun instead.</param>
         */
        public void Resume(ActionListAsset actionListAsset, bool rerunPausedActions)
        {
            if (IsListRunning(actionListAsset) && !actionListAsset.canRunMultipleInstances)
            {
                return;
            }

            bool foundInstance = false;

            for (int i = 0; i < activeLists.Count; i++)
            {
                if (activeLists[i].IsFor(actionListAsset))
                {
                    int numInstances = 0;
                    foreach (ActiveList activeList in activeLists)
                    {
                        if (activeList.IsFor(actionListAsset) && activeList.IsRunning())
                        {
                            numInstances++;
                        }
                    }

                    GameObject runtimeActionListObject = (GameObject)Instantiate(Resources.Load(Resource.runtimeActionList));
                    runtimeActionListObject.name = actionListAsset.name;
                    if (numInstances > 0)
                    {
                        runtimeActionListObject.name += " " + numInstances.ToString();
                    }

                    RuntimeActionList runtimeActionList = runtimeActionListObject.GetComponent <RuntimeActionList>();
                    runtimeActionList.DownloadActions(actionListAsset, activeLists[i].GetConversationOnEnd(), activeLists[i].startIndex, false, activeLists[i].inSkipQueue, true);
                    activeLists[i].Resume(runtimeActionList, rerunPausedActions);
                    foundInstance = true;
                    if (!actionListAsset.canRunMultipleInstances)
                    {
                        return;
                    }
                }
            }

            if (!foundInstance)
            {
                ACDebug.LogWarning("No resume data found for '" + actionListAsset + "' - running from start.", actionListAsset);
                AdvGame.RunActionListAsset(actionListAsset);
            }
        }
Example #20
0
        override public void Skip()
        {
            if (listSource == ListSource.InScene && actionList != null)
            {
                /*if (actionList.actionListType == ActionListType.RunInBackground)
                 * {
                 *      return;
                 * }*/

                if (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.actionListType == ActionListType.RunInBackground)
                 * {
                 *      return;
                 * }*/

                if (invActionList.useParameters)
                {
                    SendParameters(invActionList.parameters, true);
                }

                if (runFromStart)
                {
                    runtimeActionList = AdvGame.SkipActionListAsset(invActionList);
                }
                else
                {
                    runtimeActionList = AdvGame.SkipActionListAsset(invActionList, GetSkipIndex(invActionList.actions));
                }
            }
        }
Example #21
0
        /**
         * <summary>Runs or skips an ActionList asset file.</summary>
         * <param name = "actionListAsset">The ActionList asset to run</param>
         * <param name = "endConversation">The Conversation to enable when the ActionList is complete</param>
         * <param name = "i">The index of the Action to start from</param>
         * <param name = "doSkip">If True, all Actions within the ActionList will be run and completed instantly.</param>
         * <param name = "addToSkipQueue">True if the ActionList should be added to the skip queue</param>
         * <returns>The temporary RuntimeActionList object in the scene that performs the Actions within the asset</returns>
         */
        public static RuntimeActionList RunActionListAsset(ActionListAsset actionListAsset, Conversation endConversation, int i, bool doSkip, bool addToSkipQueue)
        {
            if (actionListAsset != null && actionListAsset.actions.Count > 0)
            {
                GameObject        runtimeActionListObject = (GameObject)Instantiate(Resources.Load(Resource.runtimeActionList));
                RuntimeActionList runtimeActionList       = runtimeActionListObject.GetComponent <RuntimeActionList>();
                runtimeActionList.DownloadActions(actionListAsset, endConversation, i, doSkip, addToSkipQueue);

                GameObject cutsceneFolder = GameObject.Find("_Cutscenes");
                if (cutsceneFolder != null && cutsceneFolder.transform.position == Vector3.zero)
                {
                    runtimeActionList.transform.parent = cutsceneFolder.transform;
                }

                return(runtimeActionList);
            }

            return(null);
        }
Example #22
0
        /**
         * <summary>Resets the associated ActionList.</summary>
         * <param name = "removeFromSkipQueue">If True, then the associated ActionList will not be run when 'EndCutscene' is triggered</param>
         */
        public void Reset(bool removeFromSkipQueue)
        {
            isRunning = false;

            if (actionList != null)
            {
                actionList.ResetList();
                if (actionList is RuntimeActionList)
                {
                    RuntimeActionList runtimeActionList = (RuntimeActionList)actionList;
                    runtimeActionList.DestroySelf();
                }
            }

            if (removeFromSkipQueue)
            {
                inSkipQueue = false;
            }
        }
Example #23
0
        /**
         * <summary>Resumes a previously-paused ActionListAsset. If the ActionListAsset is already running, nothing will happen.</summary>
         * <param name = "actionListAsset">The ActionListAsset to pause</param>
         */
        public void Resume(ActionListAsset actionListAsset)
        {
            if (IsListRunning(actionListAsset))
            {
                return;
            }

            for (int i = 0; i < activeLists.Count; i++)
            {
                if (activeLists[i].IsFor(actionListAsset))
                {
                    GameObject        runtimeActionListObject = (GameObject)Instantiate(Resources.Load(Resource.runtimeActionList));
                    RuntimeActionList runtimeActionList       = runtimeActionListObject.GetComponent <RuntimeActionList>();
                    runtimeActionList.DownloadActions(actionListAsset, activeLists[i].GetConversationOnEnd(), activeLists[i].startIndex, false, activeLists[i].inSkipQueue, true);
                    activeLists[i].Resume(runtimeActionList);
                    return;
                }
            }
            AdvGame.RunActionListAsset(actionListAsset);
        }
        /**
         * <summary>Adds a new ActionListAsset, assumed to already be running, to the internal record of currently-running ActionListAssets, and sets the correct GameState in StateHandler.</summary>
         * <param name = "runtimeActionList">The RuntimeActionList associated with the ActionListAsset to run</param>
         * <param name = "actionListAsset">The ActionListAsset that is the runtimeActionList's source, if it has one.</param>
         * <param name = "addToSkipQueue">If True, then the ActionList will be added to the list of ActionLists to skip</param>
         * <param name = "_startIndex">The index number of the Action to start skipping from, if addToSkipQueue = True</param>
         */
        public void AddToList(RuntimeActionList runtimeActionList, ActionListAsset actionListAsset, bool addToSkipQueue, int _startIndex, bool removeMultipleInstances = false)
        {
            if (!actionListAsset.canRunMultipleInstances || removeMultipleInstances)
            {
                for (int i = 0; i < activeLists.Count; i++)
                {
                    if (activeLists[i].IsFor(actionListAsset))
                    {
                        if (actionListAsset.canRunMultipleInstances && removeMultipleInstances)
                        {
                            activeLists[i].Reset(false);
                        }

                        activeLists.RemoveAt(i);
                    }
                }
            }

            addToSkipQueue = KickStarter.actionListManager.CanAddToSkipQueue(runtimeActionList, addToSkipQueue);
            activeLists.Add(new ActiveList(runtimeActionList, addToSkipQueue, _startIndex));
        }
Example #25
0
        override public float Run()
        {
            if (!isRunning)
            {
                isRunning         = true;
                runtimeActionList = null;

                if (pauseResume == PauseResume.Pause)
                {
                    if (listSource == ActionRunActionList.ListSource.AssetFile && actionListAsset != null && !actionListAsset.actions.Contains(this))
                    {
                        runtimeActionList = KickStarter.actionListAssetManager.Pause(actionListAsset);

                        if (willWait && runtimeActionList != null)
                        {
                            return(defaultPauseTime);
                        }
                    }
                    else if (listSource == ActionRunActionList.ListSource.InScene && actionList != null && !actionList.actions.Contains(this))
                    {
                        actionList.Pause();

                        if (willWait)
                        {
                            return(defaultPauseTime);
                        }
                    }
                }
                else if (pauseResume == PauseResume.Resume)
                {
                    if (listSource == ActionRunActionList.ListSource.AssetFile && actionListAsset != null && !actionListAsset.actions.Contains(this))
                    {
                        KickStarter.actionListAssetManager.Resume(actionListAsset);
                    }
                    else if (listSource == ActionRunActionList.ListSource.InScene && actionList != null && !actionList.actions.Contains(this))
                    {
                        KickStarter.actionListManager.Resume(actionList);
                    }
                }
            }
            else
            {
                if (listSource == ActionRunActionList.ListSource.AssetFile)
                {
                    if (KickStarter.actionListAssetManager.IsListRunning(actionListAsset))
                    {
                        return(defaultPauseTime);
                    }
                }
                else if (listSource == ActionRunActionList.ListSource.InScene)
                {
                    if (KickStarter.actionListManager.IsListRunning(actionList))
                    {
                        return(defaultPauseTime);
                    }
                }

                isRunning = false;
                return(0f);
            }

            return(0f);
        }
		override public void Skip ()
		{
			ActionListManager actionListManager = GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>();
			
			if (listSource == ListSource.InScene && actionList != null)
			{
				actionListManager.EndList (actionList);

				if (actionList.useParameters)
				{
					SendParameters (actionList.parameters, false);
				}

				if (runFromStart)
				{
					actionList.Interact ();
				}
				else
				{
					actionList.Interact (GetSkipIndex (actionList.actions));
				}
			}
			else if (listSource == ListSource.AssetFile && invActionList != null)
			{
				actionListManager.EndAssetList (invActionList.name);

				if (invActionList.useParameters)
				{
					SendParameters (invActionList.parameters, true);
				}

				if (runFromStart)
				{
					runtimeActionList = AdvGame.RunActionListAsset (invActionList);
				}
				else
				{
					runtimeActionList = AdvGame.RunActionListAsset (invActionList, GetSkipIndex (invActionList.actions));
				}
			}
		}
		override public float Run ()
		{
			ActionListManager actionListManager = GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>();

			if (!isRunning)
			{
				isRunning = true;
				runtimeActionList = null;

				if (listSource == ListSource.InScene)
				{
					if (actionList != null)
					{
						actionListManager.EndList (actionList);

						if (actionList.useParameters)
						{
							SendParameters (actionList.parameters, false);
						}

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

					if (runFromStart)
					{
						runtimeActionList = AdvGame.RunActionListAsset (invActionList);
					}
					else
					{
						runtimeActionList = AdvGame.RunActionListAsset (invActionList, GetSkipIndex (invActionList.actions));
					}
				}

				if (!runInParallel || (runInParallel && willWait))
				{
					return defaultPauseTime;
				}
			}
			else
			{
				if (listSource == ListSource.InScene && actionList != null)
				{
					if (actionListManager.IsListRunning (actionList))
					{
						return defaultPauseTime;
					}
					else
					{
						isRunning = false;
					}
				}
				else if (listSource == ListSource.AssetFile && invActionList != null)
				{
					if (actionListManager.IsListRunning (runtimeActionList))
					{
						return defaultPauseTime;
					}
					else
					{
						isRunning = false;
					}
				}
			}

			return 0f;
		}
        public override float Run()
        {
            if (!isRunning)
            {
                Upgrade ();

                isRunning = true;
                runtimeActionList = null;

                if (listSource == ListSource.InScene && actionList != null)
                {
                    KickStarter.actionListManager.EndList (actionList);

                    if (actionList.useParameters)
                    {
                        SendParameters (actionList.parameters, false);
                    }

                    if (runFromStart)
                    {
                        actionList.Interact (0, !isSkippable);
                    }
                    else
                    {
                        actionList.Interact (GetSkipIndex (actionList.actions), !isSkippable);
                    }
                }
                else if (listSource == ListSource.AssetFile && invActionList != null)
                {
                    KickStarter.actionListManager.EndAssetList (invActionList);

                    if (invActionList.useParameters)
                    {
                        SendParameters (invActionList.parameters, true);
                    }

                    if (runFromStart)
                    {
                        runtimeActionList = AdvGame.RunActionListAsset (invActionList, 0, !isSkippable);
                    }
                    else
                    {
                        runtimeActionList = AdvGame.RunActionListAsset (invActionList, GetSkipIndex (invActionList.actions), !isSkippable);
                    }
                }

                if (!runInParallel || (runInParallel && willWait))
                {
                    return defaultPauseTime;
                }
            }
            else
            {
                if (listSource == ListSource.InScene && actionList != null)
                {
                    if (KickStarter.actionListManager.IsListRunning (actionList))
                    {
                        return defaultPauseTime;
                    }
                    else
                    {
                        isRunning = false;
                    }
                }
                else if (listSource == ListSource.AssetFile && invActionList != null)
                {
                    if (KickStarter.actionListManager.IsListRunning (runtimeActionList))
                    {
                        return defaultPauseTime;
                    }
                    else
                    {
                        isRunning = false;
                    }
                }
            }

            return 0f;
        }
        public override void Skip()
        {
            if (listSource == ListSource.InScene && actionList != null)
            {
                /*if (actionList.actionListType == ActionListType.RunInBackground)
                {
                    return;
                }*/

                if (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.actionListType == ActionListType.RunInBackground)
                {
                    return;
                }*/

                if (invActionList.useParameters)
                {
                    SendParameters (invActionList.parameters, true);
                }

                if (runFromStart)
                {
                    runtimeActionList = AdvGame.SkipActionListAsset (invActionList);
                }
                else
                {
                    runtimeActionList = AdvGame.SkipActionListAsset (invActionList, GetSkipIndex (invActionList.actions));
                }
            }
        }
Example #30
0
        public override float Run()
        {
            if (!isRunning)
            {
                Upgrade();

                isRunning         = true;
                runtimeActionList = null;

                switch (listSource)
                {
                case ListSource.InScene:
                    if (actionList != null && !actionList.actions.Contains(this))
                    {
                        KickStarter.actionListManager.EndList(actionList);

                        if (actionList.source == ActionListSource.AssetFile && actionList.assetFile != null && actionList.assetFile.useParameters)
                        {
                            if (actionList.syncParamValues)
                            {
                                SendParameters(actionList.assetFile.GetParameters(), true);
                            }
                            else
                            {
                                SendParameters(actionList.parameters, false);
                            }
                            if (runMode == RunMode.SetParametersOnly)
                            {
                                isRunning = false;
                                return(0f);
                            }
                        }
                        else if (actionList.source == ActionListSource.InScene && actionList.useParameters)
                        {
                            SendParameters(actionList.parameters, false);
                            if (runMode == RunMode.SetParametersOnly)
                            {
                                isRunning = false;
                                return(0f);
                            }
                        }

                        if (runFromStart)
                        {
                            actionList.Interact(0, !isSkippable);
                        }
                        else
                        {
                            actionList.Interact(GetSkipIndex(actionList.actions), !isSkippable);
                        }
                    }
                    else
                    {
                        LogWarning("Could not find ActionList to run.");
                        isRunning = false;
                        return(0f);
                    }
                    break;

                case ListSource.AssetFile:
                    if (invActionList != null && !invActionList.actions.Contains(this))
                    {
                        if (invActionList.useParameters)
                        {
                            SendParameters(invActionList.GetParameters(), true);
                            if (runMode == RunMode.SetParametersOnly)
                            {
                                isRunning = false;
                                return(0f);
                            }
                        }

                        if (!invActionList.canRunMultipleInstances)
                        {
                            KickStarter.actionListAssetManager.EndAssetList(invActionList);
                        }

                        if (runFromStart)
                        {
                            runtimeActionList = AdvGame.RunActionListAsset(invActionList, 0, !isSkippable);
                        }
                        else
                        {
                            runtimeActionList = AdvGame.RunActionListAsset(invActionList, GetSkipIndex(invActionList.actions), !isSkippable);
                        }
                    }
                    else
                    {
                        LogWarning("Could not find ActionList asset to run");
                        isRunning = false;
                        return(0f);
                    }
                    break;

                default:
                    break;
                }

                if (!runInParallel || (runInParallel && willWait))
                {
                    return(defaultPauseTime);
                }
            }
            else
            {
                switch (listSource)
                {
                case ListSource.InScene:
                    if (actionList)
                    {
                        if (KickStarter.actionListManager.IsListRunning(actionList))
                        {
                            return(defaultPauseTime);
                        }
                        else
                        {
                            isRunning = false;
                        }
                    }
                    break;

                case ListSource.AssetFile:
                    if (invActionList)
                    {
                        if (invActionList.canRunMultipleInstances)
                        {
                            if (runtimeActionList != null && KickStarter.actionListManager.IsListRunning(runtimeActionList))
                            {
                                return(defaultPauseTime);
                            }
                            isRunning = false;
                        }
                        else
                        {
                            if (KickStarter.actionListAssetManager.IsListRunning(invActionList))
                            {
                                return(defaultPauseTime);
                            }
                            isRunning = false;
                        }
                    }
                    break;

                default:
                    break;
                }
            }

            return(0f);
        }
        override public float Run()
        {
            if (!isRunning)
            {
                Upgrade();

                isRunning         = true;
                runtimeActionList = null;

                if (listSource == ListSource.InScene && actionList != null && !actionList.actions.Contains(this))
                {
                    KickStarter.actionListManager.EndList(actionList);

                    if (actionList.source == ActionListSource.AssetFile && actionList.assetFile != null && actionList.assetFile.useParameters)
                    {
                        if (actionList.syncParamValues)
                        {
                            SendParameters(actionList.assetFile.parameters, true);
                        }
                        else
                        {
                            SendParameters(actionList.parameters, false);
                        }
                    }
                    else if (actionList.source == ActionListSource.InScene && actionList.useParameters)
                    {
                        SendParameters(actionList.parameters, false);
                    }

                    if (runFromStart)
                    {
                        actionList.Interact(0, !isSkippable);
                    }
                    else
                    {
                        actionList.Interact(GetSkipIndex(actionList.actions), !isSkippable);
                    }
                }
                else if (listSource == ListSource.AssetFile && invActionList != null && !invActionList.actions.Contains(this))
                {
                    if (!invActionList.canRunMultipleInstances)
                    {
                        KickStarter.actionListAssetManager.EndAssetList(invActionList);
                    }

                    if (invActionList.useParameters)
                    {
                        SendParameters(invActionList.parameters, true);
                    }

                    if (runFromStart)
                    {
                        runtimeActionList = AdvGame.RunActionListAsset(invActionList, 0, !isSkippable);
                    }
                    else
                    {
                        runtimeActionList = AdvGame.RunActionListAsset(invActionList, GetSkipIndex(invActionList.actions), !isSkippable);
                    }
                }

                if (!runInParallel || (runInParallel && willWait))
                {
                    return(defaultPauseTime);
                }
            }
            else
            {
                if (listSource == ListSource.InScene && actionList != null)
                {
                    if (KickStarter.actionListManager.IsListRunning(actionList))
                    {
                        return(defaultPauseTime);
                    }
                    else
                    {
                        isRunning = false;
                    }
                }
                else if (listSource == ListSource.AssetFile && invActionList != null)
                {
                    if (invActionList.canRunMultipleInstances)
                    {
                        if (runtimeActionList != null && KickStarter.actionListManager.IsListRunning(runtimeActionList))
                        {
                            return(defaultPauseTime);
                        }
                        isRunning = false;
                    }
                    else
                    {
                        if (KickStarter.actionListAssetManager.IsListRunning(invActionList))
                        {
                            return(defaultPauseTime);
                        }
                        isRunning = false;
                    }
                }
            }

            return(0f);
        }