using UnityEngine;
using System.Collections;

public class ActivateText : MonoBehaviour
{
    public TextAsset Text;
    public int CurrentLine;
    public int Stopper;
    public DialogueScript DialogueScript;
    public bool ButtonPressed;
    private bool Wait;
    // Use this for initialization
    void Start() //Sets dependencies
    {
        DialogueScript = FindObjectOfType<DialogueScript>();
    }

    public void Character1()
    {
        DialogueScript.ReloadScript(Text);
        DialogueScript.CurrentLine = CurrentLine;
        DialogueScript.Stopper = Stopper;
        DialogueScript.Open();  
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E))  //Every time a new conversation starts, reload dialogue list
        {
            DialogueScript.ReloadScript(Text);
            DialogueScript.CurrentLine = CurrentLine;
            DialogueScript.Stopper = Stopper;
            DialogueScript.Open();
        }
       /* else if (Input.GetKeyDown(KeyCode.E) && DialogueScript.Anger1)
        {
            DialogueScript.ReloadScript(Text);
            //CurrentLine += 8;
            //Stopper += 8;
            DialogueScript.CurrentLine = CurrentLine;
            DialogueScript.Stopper = Stopper;
            DialogueScript.Open();
        }
        else if (Input.GetKeyDown(KeyCode.E) && DialogueScript.Fear1)
        {
            DialogueScript.ReloadScript(Text);
           // CurrentLine += 5;
           // Stopper += 7;
            DialogueScript.CurrentLine = CurrentLine;
            DialogueScript.Stopper = Stopper;
            DialogueScript.Open();
        }
        /* void OnTriggerEnter(Collider other)
         {
             if (other.name == "Guy")
             {
                 if (ButtonPressed)       //Check if NPC is talkable
                 {
                     Wait = true;
                     return;
                 }
                 DialogueScript.ReloadScript(Text);         //Load assigned text
                 DialogueScript.CurrentLine = CurrentLine;
                 DialogueScript.Stopper = Stopper;
                 DialogueScript.Open();
             }
         }
         void OnTriggerExit(Collider other)
         {
             if (other.name == "Guy")            //Double check player is no longer within talking range
             {
                 Wait = false;
             }
         }*/
    }
}
