Esempio n. 1
0
    void DisplayLine()
    {
        Line line = dialogue.lines[activeLineIdx];
        DialogueCharacter character = line.character;

        if (speakerUILeft.CompareSpeaker(character))
        {
            activeSpeakerUI = speakerUILeft;
            SetDialogue(speakerUILeft, speakerUIRight, line.text);
        }
        else
        {
            activeSpeakerUI = speakerUIRight;
            SetDialogue(speakerUIRight, speakerUILeft, line.text);
        }

        if (dialogue.lines[activeLineIdx].hasVoceOver)
        {
            voiceLineManager.PlayClip(dialogue.lines[activeLineIdx].voiceLine);
            totalDelay = voiceLineManager.LengthOfClip(0) + delayAfterFinishedLine;
        }
        else
        {
            totalDelay = activeSpeakerUI.AnticipatedTypingTime() + delayAfterFinishedLine;
        }
    }
    private void StartConvorsation(DialogueCharacter character)
    {
        DialogueTree tree = character.GetDialogue();

        tree.SetCharacters(new CharacterInfo[] { info, character.GetCharacter() });
        player.PlayTree(tree);
    }
Esempio n. 3
0
    public void StartDialogue(DialogueCharacter character, Action OnSpecificDialogueEnded = null)
    {
        DialogueTree tree = character.GetDialogue();

        tree.SetCharacters(new CharacterInfo[] { playerInfo, character.GetCharacter() });
        player.PlayTree(tree, OnSpecificDialogueEnded);
    }
Esempio n. 4
0
    public void TalkTopeople(GameObject personToInteractWith)
    {
        // TODO talk to the person to interact with.
        DialogueCharacter character = personToInteractWith.GetComponent <DialogueCharacter>();//TODO choose interaction

        StartDialogue(character);
    }
Esempio n. 5
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     image         = GetComponent <Image>();
     rectTransform = GetComponent <RectTransform>();
 }
Esempio n. 6
0
    // Use this for initialization
    void Start()
    {
        dialoguesTest = new LevelDialogues();
        dialoguesTest = dialoguesTest.newSceneDialogue(1);
        DialogueCharacter fraDialogsIT = dialoguesTest.characterDialogues("Fra", dialoguesTest.dialogues, "it");
        DialogueCharacter gabDialogsIT = dialoguesTest.characterDialogues("Gabri", dialoguesTest.dialogues, "it");

        for (int i = 0; i < 2; i++)
        {
            Debug.Log(fraDialogsIT.name + ": " + fraDialogsIT.dialogueTexts[i].text);
            Debug.Log(gabDialogsIT.name + ": " + gabDialogsIT.dialogueTexts[i].text);
        }
    }
Esempio n. 7
0
    public void DisplayLine()
    {
        Line line = dialogue.lines[activeLineIdx];
        DialogueCharacter character = line.character;

        if (speakerUILeft.CompareSpeaker(character))
        {
            activeSpeakerUI = speakerUILeft;
            SetDialogue(speakerUILeft, speakerUIRight, line.text);
        }
        else
        {
            activeSpeakerUI = speakerUIRight;
            SetDialogue(speakerUIRight, speakerUILeft, line.text);
        }
    }
    private void Update()
    {
        if (!Input.GetKeyDown(KeyCode.E))
        {
            return;
        }

        //TODO replace with actual collider code
        var hits = Physics2D.CircleCastAll(transform.position, 10, transform.forward);

        foreach (var hit in hits)
        {
            DialogueCharacter character = hit.collider.GetComponent <DialogueCharacter>();;
            if (character == null)
            {
                continue;
            }

            StartConvorsation(character);
        }
    }
Esempio n. 9
0
    public DialogueCharacter characterDialogues(string characterName, List <Dialogues> dialogues, string language)
    {
        Dialogues         currentDialogue  = new Dialogues();
        DialogueCharacter currentCharacter = new DialogueCharacter();

        for (int i = 0; i < dialogues.Count; i++)
        {
            if (dialogues[i].language == language)
            {
                currentDialogue = dialogues[i];
            }
        }
        for (int i = 0; i < currentDialogue.characters.Count; i++)
        {
            if (currentDialogue.characters[i].name == characterName)
            {
                currentCharacter = currentDialogue.characters[i];
            }
        }
        return(currentCharacter);
    }
Esempio n. 10
0
    void LateUpdate()
    {
        if (activeCharacter != null)
        {
            if (Vector3.Distance(activeCharacter.transform.position, transform.position) < InteractionRadius)
            {
                return;
            }
            else
            {
                activeCharacter.SetInRange(false);
                activeCharacter = null;
            }
        }
        var dialogue = DialogueCharacter.Characters.Find(c => Vector3.Distance(c.transform.position, transform.position) < InteractionRadius);

        if (dialogue == null)
        {
            return;
        }
        dialogue.SetInRange(true);
        activeCharacter = dialogue;
    }
Esempio n. 11
0
 public bool CompareSpeaker(DialogueCharacter character)
 {
     return(speaker == character);
 }
Esempio n. 12
0
 public void SetCharacter(DialogueCharacter c)
 {
     character = c;
     characterSprite.sprite = c.characterSprites[0];
 }
Esempio n. 13
0
 // Start is called before the first frame update
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("DialogueCharacterPlayer").GetComponent <DialogueCharacter>();
 }