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

public class PopUpManager : MonoBehaviour 
{

	private float yPos;
	private float xPos;

	public GameObject sacrificePopUP;
	public GameObject fertilityPopUp;
	public GameObject divinePopUp;
	public GameObject firePopUp;
	public GameObject rainPopUp;

	public Slider sliderBarDelta;

	// Use this for initialization
	void Start () 
	{
		yPos = GetComponent<RectTransform>().rect.height;

		sacrificePopUP.GetComponent<RectTransform>().anchoredPosition = new Vector2(0,yPos);
		fertilityPopUp.GetComponent<RectTransform>().anchoredPosition = new Vector2(0,yPos);
		divinePopUp.GetComponent<RectTransform>().anchoredPosition = new Vector2(0,yPos);
		firePopUp.GetComponent<RectTransform>().anchoredPosition = new Vector2(0,yPos);
		rainPopUp.GetComponent<RectTransform>().anchoredPosition = new Vector2(0,yPos);
	}

	private GameObject currentPopUp;

	public void TurnOnSacrificePopUp(bool b)
	{
		if(sacrificePopUP != null)
		{
			sacrificePopUP.SetActive(b);

			if(b == false)
			{
				sliderBarDelta.GetComponent<WowBarDelta>().SetDeltaValue(0f);
			}
		}
	}

	public void TurnOnFertilityPopUp(bool b)
	{
		if(fertilityPopUp != null)	
		{
			fertilityPopUp.SetActive(b);

			if(b == false)
			{
				sliderBarDelta.GetComponent<WowBarDelta>().SetDeltaValue(0f);
			}
		}

	}

	public void TurnOnDivinePopUp(bool b)
	{
		if(divinePopUp != null)	
		{
			divinePopUp.SetActive(b);

			if(b == false)
			{
				sliderBarDelta.GetComponent<WowBarDelta>().SetDeltaValue(0f);
			}
		}

	}

	public void TurnOnFirePopUp(bool b)
	{
		if(firePopUp != null)
		{
			firePopUp.SetActive(b);

			if(b == false)
			{
				sliderBarDelta.GetComponent<WowBarDelta>().SetDeltaValue(0f);
			}
		}

	}

	public void TurnOnRainPopUp(bool b)
	{
		if(rainPopUp != null)	
		{
			rainPopUp.SetActive(b);

			if(b == false)
			{
				sliderBarDelta.GetComponent<WowBarDelta>().SetDeltaValue(0f);
			}
		}
	}
}
