Example #1
0
 public void end_dialogue(Player_InteractionControl player, dialogue_trigger trigger)
 {
     animator.SetBool("is_open", false);
     player.movementEnabled = true;
     player.dialogueActive  = false;
     trigger.FlipConversationStart();
 }
Example #2
0
 void Start()
 {
     origin = transform.localPosition;
     out_y  = -GetComponentInParent <Canvas>().GetComponent <RectTransform>().rect.yMax - GetComponent <RectTransform>().rect.height;
     transform.localPosition = new Vector3(transform.localPosition.x, out_y, transform.localPosition.z);
     interactionControl      = GetComponentInParent <Player_InteractionControl>();
 }
Example #3
0
 // Start is called before the first frame update
 void Start()
 {
     // "GetComponent" Completes the reference to the components
     animator           = GetComponent <Animator>();
     my_rigid_body      = GetComponent <Rigidbody2D>();
     interactionControl = GetComponent <Player_InteractionControl>();
 }
Example #4
0
 public virtual void Interact(Player_InteractionControl player)
 {
     if (!has_conversation_started)
     {
         dialogue_script.start_dialogue(dialogue, player, this);
         player.movementEnabled   = false;
         player.dialogueActive    = true;
         has_conversation_started = true;
     }
     else
     {
         dialogue_script.display_next_sentence(player, this);
     }
 }
Example #5
0
    public void start_dialogue(Dialogue dialogue, Player_InteractionControl player, dialogue_trigger trigger)
    {
        sentences.Clear();
        sentence_done = true;

        animator.SetBool("is_open", true);

        name_text.text = dialogue.name;

        foreach (string sentence in dialogue.sentences)
        {
            sentences.Enqueue(sentence);
        }

        display_next_sentence(player, trigger);
    }
Example #6
0
    public override void Interact(Player_InteractionControl player)
    {
        if (!reaction)
        {
            if (!has_conversation_started)
            {
                dialogue_script.start_dialogue(dialogue, player, this);
                player.movementEnabled   = false;
                player.dialogueActive    = true;
                has_conversation_started = true;
            }
            else
            {
                dialogue_script.display_next_sentence(player, this);
                if (!player.dialogueActive)
                {
                    if (listeners.Length != 0)
                    {
                        for (int i = 0; i < listeners.Length; i++)
                        {
                            listeners[i].SetActive(true);
                        }
                    }
                }
            }
        }


        else
        {
            if (!has_conversation_started)
            {
                dialogue_script.start_dialogue(reaction_dialogue, player, this);
                player.movementEnabled   = false;
                player.dialogueActive    = true;
                has_conversation_started = true;
            }
            else
            {
                dialogue_script.display_next_sentence(player, this);
                if (!player.dialogueActive)
                {
                    SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex - 1);
                }
            }
        }
    }
Example #7
0
 public void Use(Player_InteractionControl player, GameObject currentObject)
 {
     if (currentObject == valid_object)
     {
         if (!has_conversation_started)
         {
             dialogue_script.start_dialogue(use_valid, player, this);
             player.movementEnabled   = false;
             player.dialogueActive    = true;
             has_conversation_started = true;
         }
         else
         {
             dialogue_script.display_next_sentence(player, this);
             if (!player.dialogueActive)
             {
                 player.RemoveInventory();
                 player.useActive       = false;
                 player.movementEnabled = true;
                 valid_object.GetComponent <Object_NPC>().reaction = true;
                 valid_object.SendMessage("Interact", player);
             }
         }
     }
     else
     {
         if (!has_conversation_started)
         {
             dialogue_script.start_dialogue(use_invalid, player, this);
             player.movementEnabled   = false;
             player.dialogueActive    = true;
             has_conversation_started = true;
         }
         else
         {
             dialogue_script.display_next_sentence(player, this);
             if (!player.dialogueActive)
             {
                 player.useActive       = false;
                 player.movementEnabled = true;
             }
         }
     }
 }
Example #8
0
 public override void Interact(Player_InteractionControl player)
 {
     if (!has_conversation_started)
     {
         dialogue_script.start_dialogue(dialogue, player, this);
         player.movementEnabled   = false;
         player.dialogueActive    = true;
         has_conversation_started = true;
     }
     else
     {
         dialogue_script.display_next_sentence(player, this);
         if (!player.dialogueActive)
         {
             player.AddInventory();
             gameObject.SetActive(false);
         }
     }
 }
Example #9
0
 public void display_next_sentence(Player_InteractionControl player, dialogue_trigger trigger)
 {
     Debug.Log("chess");
     if (sentence_done && sentences.Count != 0)
     {
         sentence_done    = false;
         current_sentence = sentences.Dequeue();
         StopAllCoroutines();
         StartCoroutine(type_sentence(current_sentence));
     }
     else if (sentences.Count == 0 && sentence_done)
     {
         end_dialogue(player, trigger);
     }
     else if (!sentence_done)
     {
         StopAllCoroutines();
         dialogue_text.text = current_sentence;
         sentence_done      = true;
     }
 }