Exemple #1
0
        override public float Run()
        {
            if (overrideOptions)
            {
                if (KickStarter.playerInput.lastConversationOption >= 0)
                {
                    KickStarter.playerInput.ignoreNextConversationSkip = true;
                    return(0f);
                }
                KickStarter.playerInput.ignoreNextConversationSkip = false;
            }

            if (conversation)
            {
                if (overrideOptions)
                {
                    conversation.Interact(this);
                }
                else
                {
                    conversation.Interact();
                }
            }

            return(0f);
        }
Exemple #2
0
        override public float Run()
        {
            if (overrideOptions)
            {
                if (isAssetFile)
                {
                    Debug.LogWarning("'Dialogue: Start conversation' Action cannot override conversation options when placed in an asset file!");
                    return(0f);
                }

                if (KickStarter.playerInput.lastConversationOption >= 0)
                {
                    KickStarter.playerInput.ignoreNextConversationSkip = true;
                    return(0f);
                }
                KickStarter.playerInput.ignoreNextConversationSkip = false;
            }

            if (conversation)
            {
                if (overrideOptions)
                {
                    conversation.Interact(this);
                }
                else
                {
                    conversation.Interact();
                }
            }

            return(0f);
        }
        override public float Run()
        {
            if (overrideOptions)
            {
                if (conversation != null && conversation.lastOption >= 0)
                {
                    KickStarter.actionListManager.ignoreNextConversationSkip = true;
                    return(0f);
                }
                KickStarter.actionListManager.ignoreNextConversationSkip = false;
            }

            if (conversation)
            {
                if (overrideOptions)
                {
                    conversation.Interact(this);
                }
                else
                {
                    conversation.Interact();
                }
            }

            return(0f);
        }
Exemple #4
0
        public override float Run()
        {
            if (runtimeConversation == null)
            {
                return(0f);
            }

            if (isRunning)
            {
                if (runtimeConversation.IsActive(true))
                {
                    return(defaultPauseTime);
                }

                isRunning = false;
                return(0f);
            }

            isRunning = false;

            if (overrideOptions)
            {
                if (runtimeConversation.lastOption >= 0)
                {
                    KickStarter.actionListManager.ignoreNextConversationSkip = true;
                    return(0f);
                }
                KickStarter.actionListManager.ignoreNextConversationSkip = false;
            }


            if (overrideOptions)
            {
                runtimeConversation.Interact(this);
            }
            else
            {
                runtimeConversation.Interact();

                if (willWait && !KickStarter.settingsManager.allowGameplayDuringConversations)
                {
                    isRunning = true;
                    return(defaultPauseTime);
                }
            }

            return(0f);
        }
Exemple #5
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();
            }
        }
        public override float Run()
        {
            if (runtimeConversation == null)
            {
                return(0f);
            }

            isRunning = false;

            if (overrideOptions)
            {
                if (runtimeConversation.lastOption >= 0)
                {
                    KickStarter.actionListManager.ignoreNextConversationSkip = true;
                    return(0f);
                }
                KickStarter.actionListManager.ignoreNextConversationSkip = false;
            }

            runtimeConversation.Interact(parentActionList, this);

            return(0f);
        }
Exemple #7
0
        private void RunOption(ButtonDialog _option)
        {
            KickStarter.actionListManager.SetCorrectGameState();

            _option.hasBeenChosen = true;
            if (options.Contains(_option))
            {
                lastOption = options.IndexOf(_option);
                if (KickStarter.actionListManager.OverrideConversation(lastOption))
                {
                    return;
                }
                lastOption = -1;
            }

            Conversation endConversation = null;

            if (interactionSource != InteractionSource.CustomScript)
            {
                if (_option.conversationAction == ConversationAction.ReturnToConversation)
                {
                    endConversation = this;
                }
                else if (_option.conversationAction == ConversationAction.RunOtherConversation && _option.newConversation != null)
                {
                    endConversation = _option.newConversation;
                }
            }

            if (interactionSource == InteractionSource.AssetFile && _option.assetFile)
            {
                AdvGame.RunActionListAsset(_option.assetFile, endConversation);
            }
            else if (interactionSource == InteractionSource.CustomScript)
            {
                if (_option.customScriptObject != null && _option.customScriptFunction != "")
                {
                    _option.customScriptObject.SendMessage(_option.customScriptFunction);
                }
            }
            else if (interactionSource == InteractionSource.InScene && _option.dialogueOption)
            {
                _option.dialogueOption.conversation = endConversation;
                _option.dialogueOption.Interact();
            }
            else
            {
                ACDebug.Log("No Interaction object found!");

                if (endConversation != null)
                {
                    endConversation.Interact();
                }
                else
                {
                    KickStarter.stateHandler.gameState = GameState.Normal;
                }
            }

            KickStarter.eventManager.Call_OnClickConversation(this, _option.ID);
        }
        protected void RunOption(ButtonDialog _option)
        {
            _option.hasBeenChosen = true;
            if (options.Contains(_option))
            {
                lastOption = options.IndexOf(_option);

                if (overrideActiveList != null)
                {
                    if (overrideActiveList.actionListAsset)
                    {
                        overrideActiveList.actionList = AdvGame.RunActionListAsset(overrideActiveList.actionListAsset, overrideActiveList.startIndex, true);
                    }
                    else if (overrideActiveList.actionList)
                    {
                        overrideActiveList.actionList.Interact(overrideActiveList.startIndex, true);
                    }

                    KickStarter.eventManager.Call_OnClickConversation(this, _option.ID);
                    overrideActiveList = null;
                    return;
                }
                lastOption = -1;
            }

            Conversation endConversation = null;

            if (interactionSource != AC.InteractionSource.CustomScript)
            {
                if (_option.conversationAction == ConversationAction.ReturnToConversation)
                {
                    endConversation = this;
                }
                else if (_option.conversationAction == ConversationAction.RunOtherConversation && _option.newConversation)
                {
                    endConversation = _option.newConversation;
                }
            }

            if (interactionSource == AC.InteractionSource.AssetFile && _option.assetFile)
            {
                AdvGame.RunActionListAsset(_option.assetFile, endConversation);
            }
            else if (interactionSource == AC.InteractionSource.CustomScript)
            {
                if (_option.customScriptObject && !string.IsNullOrEmpty(_option.customScriptFunction))
                {
                    _option.customScriptObject.SendMessage(_option.customScriptFunction);
                }
            }
            else if (interactionSource == AC.InteractionSource.InScene && _option.dialogueOption)
            {
                _option.dialogueOption.conversation = endConversation;
                _option.dialogueOption.Interact();
            }
            else
            {
                ACDebug.Log("No DialogueOption object found on Conversation '" + gameObject.name + "'", this);
                KickStarter.eventManager.Call_OnEndConversation(this);

                if (endConversation)
                {
                    endConversation.Interact();
                }
            }

            KickStarter.eventManager.Call_OnClickConversation(this, _option.ID);
        }
Exemple #9
0
 /**
  * <summary>Runs the Conversation set to do so when the associated ActionList has finished.</summary>
  */
 public void RunConversation()
 {
     conversationOnEnd.Interact();
     conversationOnEnd = null;
 }
Exemple #10
0
        override public float Run()
        {
            if (KickStarter.speechManager == null)
            {
                ACDebug.Log("No Speech Manager present");
                return(0f);
            }

            if (KickStarter.dialog && KickStarter.stateHandler)
            {
                if (!isRunning)
                {
                    EventManager.OnClickConversation += GetChoiceID;
                    EventManager.OnStartSpeech       += SpeechStart;
                    EventManager.OnStopSpeech        += SpeechStop;
                    isRunning = true;
                    tagIndex  = -1;
                    choiceID  = -1;
                    SetScript();
                    return(defaultPauseTime);
                }
                else
                {
                    if (evaluatingTags)
                    {
                        float t = EvaluateTags();

                        if (t > actionComplete)
                        {
                            return(t);
                        }
                        evaluatingTags = false;
                        return(defaultPauseTime);
                    }

                    CheckSpeechAudioEnded();

                    if (speech != null)
                    {
                        if (speech.isAlive && !speech.isBackground)
                        {
                            return(defaultPauseTime);
                        }
                    }


                    if (ACInkIntegration.inkStory.canContinue && currentLine == string.Empty)
                    {
                        if (tagIndex == -1)
                        {
                            currentLine = ACInkIntegration.inkStory.Continue();
                            tagIndex    = 0;
                            if (ACInkIntegration.inkStory.currentTags.Count > 0 && !evaluatingTags)
                            {
                                evaluatingTags = true;
                                return(defaultPauseTime);
                            }
                        }
                    }

                    if (currentLine != string.Empty)
                    {
                        RunScript(currentLine);
                        tagIndex    = -1;
                        currentLine = string.Empty;
                        return(defaultPauseTime);
                    }

                    if (conversation != null)
                    {
                        if (!conversation.IsActive(false) && choiceID >= 0)
                        {
                            ACInkIntegration.inkStory.ChooseChoiceIndex(choiceID);
                            choiceID = -1;
                            tagIndex = -1;
                            return(defaultPauseTime);
                        }

                        if (ACInkIntegration.inkStory.currentChoices.Count > 0 && !conversation.IsActive(false))
                        {
                            GetChoices();
                            if (conversation.options.Count == 1 && autoSelectLoneOption)
                            {
                                choiceID = 0;
                                return(defaultPauseTime);
                            }
                            else
                            {
                                conversation.Interact();
                            }
                        }

                        if (conversation != null && conversation.IsActive(false))
                        {
                            return(defaultPauseTime);
                        }
                    }
                    isRunning = false;
                    EventManager.OnClickConversation -= GetChoiceID;
                    EventManager.OnStartSpeech       -= SpeechStart;
                    EventManager.OnStopSpeech        -= SpeechStop;
                    return(0f);
                }
            }
            return(0f);
        }