using UnityEngine;
using System.Collections;

public class PopupBackground : MonoBehaviour
{
		BoxCollider popupBackgroundCollider;
		UITweener popupBackgroundTweener;
		bool backGroundFaded = true;
		
		void Awake ()
		{
				popupBackgroundTweener = this.GetComponent<UITweener> ();
				popupBackgroundCollider = this.GetComponent<BoxCollider> ();
		}
		void OnClick ()
		{
				//PopupManager.instance.PopupTweenOutCurrent ();
		}
		
	
		public void Show (bool fadeOutBackground = true)
		{
				popupBackgroundCollider.enabled = true;
				if (fadeOutBackground) {
						popupBackgroundTweener.PlayForward ();
						backGroundFaded = true;
				}
		
		}
		public void Hide ()
		{
				popupBackgroundCollider.enabled = false;
				if (backGroundFaded) {
						popupBackgroundTweener.PlayReverse ();
						backGroundFaded = false;
				}
		}		
	
		
}
