using UnityEngine;
using System.Collections;
using com.deeperbeige.lib;

namespace com.deeperbeige.whiteout
{
	internal class Startup : MonoBehaviour
	{
		// These objects are found at runtime and then destroyed.
		// Helps hide things that shouldn't be visible like guide layers,
		// static lights that only contribute to lightmap baking and so on.
		private string[] autoDestroy  = new string[] {  };
		
		// These objects are found at runtime and set to active
		// Helps with triggering Start() and Awake() that otherwise
		// wouldn't run, so events can be registered etc.
		private string[] autoActivate = new string[] { "WhiteScreen" };
		
		private string[] autoDeactivate = new string[] { "Pause" };

		private void Start ()
		{
			foreach (string name in autoDestroy)
			{
				GameObject go = GameObjects.FindAnywhere(name, true);
				if (go != null) Destroy(go);
			}
			
			foreach (string name in autoActivate)
			{
				GameObject go = GameObjects.FindAnywhere(name, true);
				if (go != null) go.SetActive(true);
			}

			foreach (string name in autoDeactivate)
			{
				GameObject go = GameObjects.FindAnywhere(name, true);
				if (go != null) go.SetActive(false);
			}
		}
	}
}
