using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class Executioner : MonoBehaviour 
{
    public TortureManager m_manager;
    public float m_sanity = 100;
    public GameObject[] m_portraits;
    public GameObject m_bgGood;
    public GameObject m_bgNeutral;
    public GameObject m_bgBad;
    public Text m_text;
	// Use this for initialization
	void Start () 
    {
        m_manager = GameObject.FindGameObjectWithTag("TortureManager").GetComponent<TortureManager>();
	}
	
	// Update is called once per frame
	void Update () 
    {
        if (m_sanity >= 200)
        {
            m_portraits[0].SetActive(true);
            m_portraits[1].SetActive(false);
            m_portraits[2].SetActive(false);
            m_portraits[3].SetActive(false);
            m_portraits[4].SetActive(false);
            m_portraits[5].SetActive(false);
            m_portraits[6].SetActive(false);
            m_portraits[7].SetActive(false);
            m_portraits[8].SetActive(false);
            m_portraits[8].SetActive(false);
        }
        else if (m_sanity >= 175)
        {
            m_portraits[0].SetActive(false);
            m_portraits[1].SetActive(true);
            m_portraits[2].SetActive(false);
            m_portraits[3].SetActive(false);
            m_portraits[4].SetActive(false);
            m_portraits[5].SetActive(false);
            m_portraits[6].SetActive(false);
            m_portraits[7].SetActive(false);
            m_portraits[8].SetActive(false);
        }
        else if (m_sanity >= 150)
        {
            m_portraits[0].SetActive(false);
            m_portraits[1].SetActive(false);
            m_portraits[2].SetActive(true);
            m_portraits[3].SetActive(false);
            m_portraits[4].SetActive(false);
            m_portraits[5].SetActive(false);
            m_portraits[6].SetActive(false);
            m_portraits[7].SetActive(false);
            m_portraits[8].SetActive(false);
        }
        else if (m_sanity >= 125)
        {
            m_portraits[0].SetActive(false);
            m_portraits[1].SetActive(false);
            m_portraits[2].SetActive(false);
            m_portraits[3].SetActive(true);
            m_portraits[4].SetActive(false);
            m_portraits[5].SetActive(false);
            m_portraits[6].SetActive(false);
            m_portraits[7].SetActive(false);
            m_portraits[8].SetActive(false);
            m_bgGood.SetActive(true);
            m_bgNeutral.SetActive(false);
            m_bgGood.SetActive(false);
        }
        else if (m_sanity >= 75)
        {
            m_portraits[0].SetActive(false);
            m_portraits[1].SetActive(false);
            m_portraits[2].SetActive(false);
            m_portraits[3].SetActive(false);
            m_portraits[4].SetActive(true);
            m_portraits[5].SetActive(false);
            m_portraits[6].SetActive(false);
            m_portraits[7].SetActive(false);
            m_portraits[8].SetActive(false);
            m_bgGood.SetActive(false);
            m_bgNeutral.SetActive(true);
            m_bgGood.SetActive(false);
        }
        else if (m_sanity >= 50)
        {
            m_portraits[0].SetActive(false);
            m_portraits[1].SetActive(false);
            m_portraits[2].SetActive(false);
            m_portraits[3].SetActive(false);
            m_portraits[4].SetActive(false);
            m_portraits[5].SetActive(true);
            m_portraits[6].SetActive(false);
            m_portraits[7].SetActive(false);
            m_portraits[8].SetActive(false);
            m_bgGood.SetActive(false);
            m_bgNeutral.SetActive(false);
            m_bgGood.SetActive(true);
        }
        else if (m_sanity >= 25)
        {
            m_portraits[0].SetActive(false);
            m_portraits[1].SetActive(false);
            m_portraits[2].SetActive(false);
            m_portraits[3].SetActive(false);
            m_portraits[4].SetActive(false);
            m_portraits[5].SetActive(false);
            m_portraits[6].SetActive(true);
            m_portraits[7].SetActive(false);
            m_portraits[8].SetActive(false);
        }
        else if (m_sanity >= 0)
        {
            m_portraits[0].SetActive(false);
            m_portraits[1].SetActive(false);
            m_portraits[2].SetActive(false);
            m_portraits[3].SetActive(false);
            m_portraits[4].SetActive(false);
            m_portraits[5].SetActive(false);
            m_portraits[6].SetActive(false);
            m_portraits[7].SetActive(true);
            m_portraits[8].SetActive(false);
        }
        else
        {
            m_portraits[0].SetActive(false);
            m_portraits[1].SetActive(false);
            m_portraits[2].SetActive(false);
            m_portraits[3].SetActive(false);
            m_portraits[4].SetActive(false);
            m_portraits[5].SetActive(false);
            m_portraits[6].SetActive(false);
            m_portraits[7].SetActive(false);
            m_portraits[8].SetActive(true);
            Debug.Log("Executioner - I'm dead mofo!");
        }
	}

    public void OnNewVictim(bool _released)
    {

    }
}
