Пример #1
0
    public void Interact(PlayerInteraction player)
    {
        dialogues.Reset();
        Player Player = player.GetComponent <Player>();

        Player.dialogue.StartConversation(dialogues, DialogueTree, DialogueImage);
    }
Пример #2
0
 public void StartInteraction(GameObject obj, string str, int random_responses, int index = -1)
 {
     active       = true;
     interactable = obj.GetComponent <Interactable>();
     if (interactable.isPerson)
     {
         portrait.GetComponent <Image>().sprite = interactable.portrait;
         portraitItem.SetActive(false);
         portrait.SetActive(true);
     }
     else
     {
         portraitItem.GetComponent <Image>().sprite = interactable.portrait;
         portraitItem.SetActive(true);
         portrait.SetActive(false);
     }
     interactable.Interact();
     dialogues = interactable.GetComponent <Dialogues>();
     if (index == -1)
     {
         if (random_responses > 0)
         {
             int ind = Random.Range(0, random_responses);
             dialogues.SetTree(ind.ToString());
         }
         else
         {
             dialogues.SetTree(str);
         }
     }
     else
     {
         dialogues.SetTree(index.ToString());
     }
     dialogues.Reset();
     dialogueText.text = dialogues.GetCurrentDialogue();
     dialogueUI.SetActive(true);
 }