/**
         * <summary>Creates a new instance of the 'Dialogue: Start conversation' Action</summary>
         * <param name = "conversationToRun">The Conversation to begin</param>
         * <returns>The generated Action</returns>
         */
        public static ActionConversation CreateNew(Conversation conversationToRun)
        {
            ActionConversation newAction = (ActionConversation)CreateInstance <ActionConversation>();

            newAction.conversation = conversationToRun;
            return(newAction);
        }
Example #2
0
 /**
  * <summary>Sets the point to continue from, when a Conversation's options are overridden by an ActionConversation.</summary>
  * <param title = "actionConversation">The "Dialogue: Start conversation" Action that is overriding the Conversation's options</param>
  */
 public void SetConversationPoint(ActionConversation actionConversation)
 {
     foreach (ActiveList activeList in activeLists)
     {
         activeList.SetConversationOverride(actionConversation);
     }
     foreach (ActiveList activeList in KickStarter.actionListAssetManager.activeLists)
     {
         activeList.SetConversationOverride(actionConversation);
     }
 }
Example #3
0
 /**
  * <summary>Resets the associated ActionList and records the index of an ActionConversation instance, if it is within the ActionList's list of Actions.</summary>
  * <param name = "actionConversation">The ActionConversation to search for</param>
  */
 public void SetConversationOverride(ActionConversation actionConversation)
 {
     if (actionList != null)
     {
         foreach (Action action in actionList.actions)
         {
             if (action == actionConversation)
             {
                 startIndex             = actionList.actions.IndexOf(action);
                 isConversationOverride = true;
                 Reset(true);
                 return;
             }
         }
     }
 }
Example #4
0
        /**
         * <summary>Shows the Conversation's dialogue options.</summary>
         * <param name = "actionConversation">The "Dialogue: Start conversation" Action that calls this function.  This is necessary when that Action overrides the Converstion's options.</param>
         */
        public void Interact(ActionConversation actionConversation)
        {
            KickStarter.actionListManager.SetConversationPoint(actionConversation);
            KickStarter.eventManager.Call_OnStartConversation(this);

            CancelInvoke("RunDefault");
            int numPresent = 0;

            foreach (ButtonDialog _option in options)
            {
                if (_option.CanShow())
                {
                    numPresent++;
                }
            }

            if (KickStarter.playerInput)
            {
                if (numPresent == 1 && autoPlay)
                {
                    foreach (ButtonDialog _option in options)
                    {
                        if (_option.CanShow())
                        {
                            RunOption(_option);
                            return;
                        }
                    }
                }
                else if (numPresent > 0)
                {
                    KickStarter.playerInput.activeConversation = this;
                    KickStarter.stateHandler.gameState         = GameState.DialogOptions;
                }
                else
                {
                    KickStarter.playerInput.EndConversation();
                }
            }

            if (isTimed)
            {
                startTime = Time.time;
                Invoke("RunDefault", timer);
            }
        }
Example #5
0
        public void SetConversationPoint(ActionConversation actionConversation)
        {
            if (actionConversation == null)
            {
                activeConversationPoint = new SkipList();
            }

            foreach (ActionList actionList in activeLists)
            {
                foreach (Action action in actionList.actions)
                {
                    if (action == actionConversation)
                    {
                        activeConversationPoint = new SkipList(actionList, actionList.actions.IndexOf(action));
                        actionList.Kill();
                        return;
                    }
                }
            }
        }
Example #6
0
        /**
         * <summary>Shows the Conversation's dialogue options.</summary>
         * <param name = "actionList">The ActionList that contains the Action that calls this function</param>
         * <param name = "actionConversation">The "Dialogue: Start conversation" Action that calls this function.  This is necessary when that Action overrides the Converstion's options.</param>
         */
        public void Interact(ActionList actionList, ActionConversation actionConversation)
        {
            overrideActiveList = null;

            if (actionList)
            {
                onFinishActiveList = null;

                int actionIndex = actionList.actions.IndexOf(actionConversation);
                if (actionList && actionIndex >= 0 && actionIndex < actionList.actions.Count)
                {
                    if (actionConversation.overrideOptions)
                    {
                        overrideActiveList = new ActiveList(actionList, true, actionIndex);
                        actionList.ResetList();
                    }
                    else if (actionConversation.willWait && !KickStarter.settingsManager.allowGameplayDuringConversations && actionConversation.endings.Count > 0)
                    {
                        ActionEnd ending = actionConversation.endings[0];
                        if (ending.resultAction != ResultAction.Stop)
                        {
                            switch (ending.resultAction)
                            {
                            case ResultAction.Continue:
                                if (actionIndex < actionList.actions.Count - 1)
                                {
                                    onFinishActiveList = new ActiveList(actionList, true, actionIndex + 1);
                                }
                                break;

                            case ResultAction.Skip:
                                onFinishActiveList = new ActiveList(actionList, true, ending.skipAction);
                                break;

                            case ResultAction.RunCutscene:
                                if (actionList is RuntimeActionList)
                                {
                                    if (ending.linkedAsset)
                                    {
                                        onFinishActiveList = new ActiveList(null, true, 0);
                                        onFinishActiveList.actionListAsset = ending.linkedAsset;
                                    }
                                }
                                else if (ending.linkedCutscene)
                                {
                                    onFinishActiveList = new ActiveList(ending.linkedCutscene, true, 0);
                                }
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }

            KickStarter.eventManager.Call_OnStartConversation(this);

            CancelInvoke("RunDefault");
            int numPresent = 0;

            foreach (ButtonDialog _option in options)
            {
                if (_option.CanShow())
                {
                    numPresent++;
                }
            }

            if (numPresent == 1 && autoPlay)
            {
                foreach (ButtonDialog _option in options)
                {
                    if (_option.CanShow())
                    {
                        RunOption(_option);
                        return;
                    }
                }
            }
            else if (numPresent > 0)
            {
                KickStarter.playerInput.activeConversation = this;
            }
            else
            {
                KickStarter.playerInput.EndConversation();
                return;
            }

            if (isTimed)
            {
                startTime = Time.time;
                Invoke("RunDefault", timer);
            }
        }
        /**
         * <summary>Sets the point to continue from, when a Conversation's options are overridden by an ActionConversation.</summary>
         * <param title = "actionConversation">The "Dialogue: Start conversation" Action that is overriding the Conversation's options</param>
         */
        public void SetConversationPoint(ActionConversation actionConversation)
        {
            if (actionConversation == null)
            {
                activeConversationPoint = new SkipList();
            }

            foreach (ActionList actionList in activeLists)
            {
               foreach (Action action in actionList.actions)
                {
                    if (action == actionConversation)
                    {
                        activeConversationPoint = new SkipList (actionList, actionList.actions.IndexOf (action));
                        if (!(actionList is RuntimeActionList))
                        {
                            actionList.Kill ();
                        }
                        return;
                    }
                }
            }
        }
Example #8
0
        public void Interact(ActionConversation actionConversation = null)
        {
            KickStarter.actionListManager.SetConversationPoint (actionConversation);

            CancelInvoke ("RunDefault");
            int numPresent = 0;
            foreach (ButtonDialog _option in options)
            {
                if (_option.isOn)
                {
                    numPresent ++;
                }
            }

            if (KickStarter.playerInput)
            {
                if (numPresent == 1 && autoPlay)
                {
                    foreach (ButtonDialog _option in options)
                    {
                        if (_option.isOn)
                        {
                            RunOption (_option);
                            return;
                        }
                    }
                }
                else if (numPresent > 0)
                {
                    KickStarter.playerInput.activeConversation = this;
                    KickStarter.stateHandler.gameState = GameState.DialogOptions;
                }
                else
                {
                    KickStarter.playerInput.activeConversation = null;
                }
            }

            if (isTimed)
            {
                startTime = Time.time;
                Invoke ("RunDefault", timer);
            }
        }