Esempio n. 1
0
    public void EvaluateBeat(BeatData beat)
    {
        if (currentClient != null && !dialogueMenu.isResuming)
        {
            currentClient.AddBeatToConversation(beat);
        }
        if (beat.IsEnd)
        {
            phoneAnim.enabled = true;
            phoneAnim.Play("ActivatePlayButton");
            if (beat.HasScene)
            {
                FindObjectOfType <PhoneButtons>().EnableStartButton(beat.TargetScene);
            }
            else
            {
                FindObjectOfType <PhoneButtons>().EnableStartButton();
            }
        }



        //if beat doesn't end dialogue
        //evaluate next dialogue beats
        else
        {
            //if dialogue has choices
            if (beat.GetChoices().Count > 0)
            {
                //Get all choices
                List <ChoiceData> choices = beat.GetChoices();

                //generate a choice display for each choice
                for (int i = 0; i < beat.GetChoices().Count; i++)
                {
                    dialogueMenu.DisplayChoice(i, choices[i].DisplayText, choices[i].NextID, choices[i]);
                }
            }
            else
            {
                if (beat.Chains)
                {
                    if (beatData.GetBeatById(beat.TargetID).IsClientBeat)
                    {
                        dialogueMenu.DisplayClientBeat(beat.TargetID, beatData.GetBeatById(beat.TargetID).TypeTime, Speaker.Client);
                    }
                    else
                    {
                        dialogueMenu.DisplayClientBeat(beat.TargetID, beatData.GetBeatById(beat.TargetID).TypeTime, Speaker.MainCharacter);
                    }
                }
            }
        }
    }
Esempio n. 2
0
    private void DisplayBeat(int id)
    {
        BeatData data = _data.GetBeatById(id);

        StartCoroutine(DoDisplay(data));
        _currentBeat = data;
    }
Esempio n. 3
0
    private void handleChoice(int i) 
    {
        if(i < 0 || i > _currentChoices.Length) return;

        ChoiceData choice = _currentChoices[i];
        BeatData nextBeat = _data.GetBeatById(choice.NextID);
        NPC npcSpeaking = PlayerController.instance.npcSpeaking;

        // If the choice is unavailable (button inactive) then don't continue with the choice
        if(npcSpeaking.HasUsedDialogueType(choice.Type)) return;
        if(choice.TextType == ChoiceTextType.BribeAmount && !LevelManager.instance.CanAffordBribe(i)) return;

        if(nextBeat.Type != DialogueType.Goodbye) 
        {
            switch(nextBeat.DisplayTextType) 
            {
                case SpeechType.FlatterResponse:
                    npcSpeaking.RespondToFlattery(choice.IsCorrectChoice);
                    break;
                case SpeechType.ThreatenResponse:
                    npcSpeaking.RespondToThreaten(choice.IsCorrectChoice);
                    break;
                case SpeechType.BribeResponse:
                    choice.IsCorrectChoice = npcSpeaking.ReceiveBribe(i);
                    LevelManager.instance.SpendBribe(i);
                    break;
                case SpeechType.RumourStart:
                    choice.IsCorrectChoice = npcSpeaking.CanGiveRumour() && HasRumourAvailable(npcSpeaking);
                    if(choice.IsCorrectChoice && !unlockedRumours.ContainsKey(npcSpeaking))
                    {
                        UnlockRandomRumour(npcSpeaking);
                    }
                    break;
                case SpeechType.RumourEnd:
                    npcSpeaking.CompleteRumour();
                    break;
            }
            DisplayBeat(choice.NextID, false, choice.IsCorrectChoice);
        } 
        else 
        {
            PlayerController.instance.ExitDialogue();
        }
    }
Esempio n. 4
0
    public void DisplayBeat(int id, Speaker newSpeaker)
    {
        currentSpeaker = newSpeaker;
        BeatData data = storyData.GetBeatById(id);

        //if there is no previous bubble assume this is the start of the conversation
        //if there is no previous bubble assume this is the start of the conversation
        if (previousBubble == false)
        {
            DisplayFirstBeat(data);
        }
        //if not append from previous bubble
        else
        {
            DisplaySmsBubble(data);
        }

        OnBeatDisplayed?.Invoke(data);
    }
Esempio n. 5
0
    private void DisplayBeat(int id)
    {
        BeatData data = _data.GetBeatById(id);

        StartCoroutine(DoDisplay(data));
        _currentBeat = data;

        if (data.bossPick)
        {
            Player.instance.sceneLoader.spawnBoss(data.goodChoice);
        }

        if (data.getChoiceList().Count == 0)
        {
            Invoke("showCloseButton", 1);
            Player.instance.menus.lockSelection(true);
        }
    }