using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

public class HideLayers : MonoBehaviour {

	[HideInInspector]
	public bool hideLayers = true;

	// Use this for initialization
	void Start () {
		if (hideLayers) {
			LockAndHide ();
		}
	}

	void OnValidate () {
		if (hideLayers) {
			LockAndHide ();
		}
	}
		
	void LockAndHide () {
		#if UNITY_EDITOR
		Tools.lockedLayers = (1 << LayerMask.NameToLayer ("UI")) |
			(1 << LayerMask.NameToLayer ("Camera")) |
			(1 << LayerMask.NameToLayer ("Level Editor")) |
			(1 << LayerMask.NameToLayer ("MiniMap")) |
			(1 << LayerMask.NameToLayer ("UI Cameras")) |
			(1 << LayerMask.NameToLayer ("BigMap")) |
			(1 << LayerMask.NameToLayer ("HideOnCamera")) |
			(1 << LayerMask.NameToLayer ("OuterBounds"));
		Tools.visibleLayers = ~((1 << LayerMask.NameToLayer ("UI")) |
			(1 << LayerMask.NameToLayer ("Camera")) |
			(1 << LayerMask.NameToLayer ("Level Editor")) |
			(1 << LayerMask.NameToLayer ("MiniMap")) |
			(1 << LayerMask.NameToLayer ("UI Cameras")) |
			(1 << LayerMask.NameToLayer ("BigMap")) |
			(1 << LayerMask.NameToLayer ("HideOnCamera")) |
			(1 << LayerMask.NameToLayer ("OuterBounds")));
		#endif
	}
}
