using UnityEngine;
using System.Collections;

public class AnswerScript : MonoBehaviour
{
    public DialogueScript Dialogue;
    public bool Answer = false;
    // Use this for initialization
    void Start()
    {
        Dialogue = FindObjectOfType<DialogueScript>();
    }

    public void Answer1()
    {
        if (Dialogue.CurrentLine == 1)
        {
            Dialogue.Fear1 = true;
            Answer = true;
            Dialogue.FearAnswer.SetActive(false);
            Dialogue.AngerAnswer.SetActive(false);
            Dialogue.LoveAnswer.SetActive(false);
            Dialogue.CurrentLine += 1;
        }
        else if (Dialogue.CurrentLine == 4)
        {
            Dialogue.Fear1 = true;
            Answer = true;
            Dialogue.FearAnswer.SetActive(false);
            Dialogue.AngerAnswer.SetActive(false);
            Dialogue.LoveAnswer.SetActive(false);
            Dialogue.CurrentLine -= 2;
        }
    }
    public void Answer2()
    {
        if (Dialogue.CurrentLine == 1)
        {
            Dialogue.Anger1 = true;
            Answer = true;
            Dialogue.FearAnswer.SetActive(false);
            Dialogue.AngerAnswer.SetActive(false);
            Dialogue.LoveAnswer.SetActive(false);
            Dialogue.CurrentLine += 2;
        }
        if (Dialogue.CurrentLine == 4)
        {
            Dialogue.Anger1 = true;
            Answer = true;
            Dialogue.FearAnswer.SetActive(false);
            Dialogue.AngerAnswer.SetActive(false);
            Dialogue.LoveAnswer.SetActive(false);
            Dialogue.CurrentLine -= 1;
        }
        if (Dialogue.CurrentLine == 14)
        {
            Dialogue.Anger1 = true;
            Answer = true;
            Dialogue.FearAnswer.SetActive(false);
            Dialogue.AngerAnswer.SetActive(false);
            Dialogue.LoveAnswer.SetActive(false);
            Dialogue.CurrentLine += 2;
        }
    }
    public void Answer3()
    {
        Dialogue.Neutral = true;
        Dialogue.CurrentLine += 3;
    }
    public void NoThanks()
    {
        Dialogue.NothingThanks.SetActive(false);
        Dialogue.FearAnswer.SetActive(false);
        Dialogue.AngerAnswer.SetActive(false);
        Dialogue.NothingThanks.SetActive(false);
        Dialogue.CurrentLine -= 4;
        Dialogue.AnswerTime = false;
        Dialogue.Close();
    }
    public void Love()
    {
        Dialogue.LoveAnswer.SetActive(false);
        Dialogue.FearAnswer.SetActive(false);
        Dialogue.AngerAnswer.SetActive(false);
        Dialogue.AnswerTime = false;
        Dialogue.Final = true;
        Dialogue.CurrentLine += 4;
    }
    public void Closing()
    {
        Dialogue.Close();
        Dialogue.AnswerTime = false;
    }
    public void DoYouKnow()
    {
        Answer = true;
        Dialogue.AngerAnswer.SetActive(false);
        Dialogue.Fear1 = false;
        Dialogue.Final2 = true;
        Dialogue.ToScene2.SetActive(true);
        Dialogue.CurrentLine += 1;
    }
    public void Nothing()
    {
        Dialogue.Anger1 = true;
        Dialogue.AngerAnswer.SetActive(false);
        Answer = true;
        Dialogue.Fear1 = false;
        Dialogue.Anger1 = true;
        Dialogue.CurrentLine += 3;
    }
    public void KnockDrink()
    {
        if (Dialogue.CurrentLine == 30)
        {
            Dialogue.KnockHisDrink.SetActive(false);
            Dialogue.PatronAnger = true;
            Dialogue.Anger1 = true;
            Answer = true;
            Dialogue.CurrentLine += 1;
        }
        if (Dialogue.CurrentLine == 36)
        {
            Dialogue.KnockHisDrink.SetActive(false);
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 1;
        }
        if (Dialogue.CurrentLine == 42)
        {
            Dialogue.KnockHisDrink.SetActive(false);
            Dialogue.WalkAway.SetActive(false);
            Dialogue.PatronFinal = false;
            Dialogue.PatronAnger = true;
            Dialogue.AngerOption = true;
            Answer = true;
            Dialogue.CurrentLine += 3;
        }
    }
    public void SomethingSpecial()
    {
        Dialogue.AnswerTime = false;
        Dialogue.CurrentLine += 2;
    }
    public void Actually()
    {
        Dialogue.KnockHisDrink.SetActive(false);
        Dialogue.ToScene2.SetActive(true);
        Dialogue.PatronFinal = true;
        Dialogue.AnswerTime = false;
        //Answer = true;
        Dialogue.CurrentLine += 1;
    }
    public void OhThankYou()
    {
        Dialogue.KnockHisDrink.SetActive(false);
        Dialogue.LoveOption = true;
        Dialogue.PatronLove = true;
        Answer = true;
        Dialogue.CurrentLine += 3;
    }
    public void DoYouKnowPatron()
    {
        Dialogue.KnockHisDrink.SetActive(false);
        Dialogue.AnswerTime = false;
        //Answer = true;
        Dialogue.PatronLove = false;
        Dialogue.ToScene2.SetActive(true);
        Dialogue.PatronFinal = true;
        Dialogue.CurrentLine += 2;
    }
    public void WalkAway()
    {
        if (Dialogue.CurrentLine == 37)
        {
            Dialogue.WalkAway.SetActive(false);
            Dialogue.PatronAnger = true;
            Dialogue.PatronLove = false;
            Dialogue.AngerOption = true;
            Answer = true;
            Dialogue.CurrentLine += 3;
        }
        if (Dialogue.CurrentLine == 42)
        {
            Dialogue.KnockHisDrink.SetActive(false);
            Dialogue.WalkAway.SetActive(false);
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 2;
        }
    }
    public void PatronFear()
    {
        Dialogue.PatronAnger = true;
        Dialogue.AngerOption = true;
        Dialogue.PatronLove = false;
        Answer = true;
        Dialogue.CurrentLine += 4;
    }
    public void FearPool()
    {
        if (Dialogue.CurrentLine == 47)
        {
            Dialogue.FearPool.SetActive(false);
            Dialogue.AngerPool.SetActive(false);
            Answer = true;
            Dialogue.FearPoolState = true;
            Dialogue.CurrentLine += 2;
        }
        if (Dialogue.CurrentLine == 50)
        {
            Dialogue.FearPool.SetActive(false);
            Dialogue.AngerPool.SetActive(false);
            Answer = true;
            Dialogue.FearPoolState = false;
            Dialogue.AngerPoolState = true;
            Dialogue.AngerOption = true;
            Dialogue.CurrentLine += 1;
        }
    }
    public void AngerPool()
    {
        if (Dialogue.CurrentLine == 47)
        {
            Dialogue.FearPool.SetActive(false);
            Dialogue.AngerPool.SetActive(false);
            Answer = true;
            Dialogue.AngerPoolState = true;
            Dialogue.AngerOption = true;
            Dialogue.CurrentLine += 1;
        }
        if (Dialogue.CurrentLine == 50)
        {
            Dialogue.FearPool.SetActive(false);
            Dialogue.AngerPool.SetActive(false);
            Answer = true;
            Dialogue.FearPoolState = false;
            Dialogue.AngerOption = true;
            Dialogue.AngerPoolState = true;
            Dialogue.CurrentLine += 2;
        }
    }
    public void BGFear()
    {
        Answer = true;
        Dialogue.BigGothSorrow = true;
        Dialogue.CurrentLine += 1;
    }
    public void BGAnger()
    {
        Dialogue.AnswerTime = false;
        //Dialogue.bigGothAnger = true;
        Dialogue.CurrentLine += 2;
    }
    public void BGLove()
    {
        Dialogue.AnswerTime = false;
        // Dialogue.bigGothLove = true;
        Dialogue.CurrentLine += 3;
    }
    public void Steal()
    {
        Dialogue.bigGothAnger = true;
        Dialogue.Accident.SetActive(false);
        Answer = true;
        Dialogue.CurrentLine += 2;
    }
    public void Accident()
    {
        if (Dialogue.CurrentLine == 62)
        {
            Dialogue.BigGothFinal = true;
            Dialogue.ToScene3.SetActive(true);
            Dialogue.Accident.SetActive(false);
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 3;
        }
        if (Dialogue.CurrentLine == 63)
        {         
            Dialogue.ToScene3.SetActive(true);
            Dialogue.Accident.SetActive(false);
            Dialogue.bigGothLove = true;
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 4;
        }
    }
    public void FAnswer1()
    {
        if (Dialogue.CurrentLine == 125)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 4;
        }
        else if (Dialogue.CurrentLine == 129)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 8;
        }
        else if (Dialogue.CurrentLine == 130)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 57;
        }
        else if (Dialogue.CurrentLine == 131)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 99;
        }
        else if (Dialogue.CurrentLine == 132)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 136;
        }
        else if (Dialogue.CurrentLine == 133)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 170;
        }
    }
    public void FAnswer2()
    {
        if (Dialogue.CurrentLine == 125)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine++;
        }
        else if (Dialogue.CurrentLine == 129)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 5;
        }
        else if (Dialogue.CurrentLine == 131)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 96;
        }
        else if (Dialogue.CurrentLine == 132)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 133;
        }
        else if (Dialogue.CurrentLine == 133)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 171;
        }
    }
    public void FAnswer3()
    {
        if (Dialogue.CurrentLine == 125)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 6;
        }
        else if (Dialogue.CurrentLine == 129)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 31;
        }
        else if (Dialogue.CurrentLine == 130)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 67;
        }
        else if (Dialogue.CurrentLine == 132)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 134;
        }
        else if (Dialogue.CurrentLine == 133)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 172;
        }
        else if (Dialogue.CurrentLine == 212)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine++;
        }
    }
    public void FAnswer4()
    {
        if (Dialogue.CurrentLine == 125)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 2;
        }
        else if (Dialogue.CurrentLine == 129)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 6;
        }
        else if (Dialogue.CurrentLine == 130)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 55;
        }
        else if (Dialogue.CurrentLine == 131)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 97;
        }
        else if (Dialogue.CurrentLine == 133)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 173;
        }
    }
    public void FAnswer5()
    {
        if (Dialogue.CurrentLine == 125)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 3;
        }
        else if (Dialogue.CurrentLine == 129)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 7;
        }
        else if (Dialogue.CurrentLine == 130)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 56;
        }
        else if (Dialogue.CurrentLine == 131)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 98;
        }
        else if (Dialogue.CurrentLine == 132)
        {
            Dialogue.AnswerTime = false;
            Dialogue.CurrentLine += 135;
        }
    }
    public void Test()
    {
        //Dialogue.Anger1 = true;
        Dialogue.Love1 = true;
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Mouse0) && Answer)
        {
            Answer = false;
            Invoke("Closing", 0.5f);
        }
    }
}