using UnityEngine;
using System.Collections;

namespace Util
{
	public class EffectManager : MonoBehaviour
	{
		/// <summary>
		/// Singleton. Gets the instance.
		/// </summary>
		/// <returns>The instance.</returns>
		public static EffectManager GetInstance() {
			if (null == instance) {
				GameObject go = new GameObject("EffectManager");
				instance = go.AddComponent<EffectManager>();
			}
			return instance;
		}
		static EffectManager instance;

		[SerializeField]
		GameObject effect_HeEscaped;
		[SerializeField]
		GameObject effect_GameEnd;

		void Awake() {
			effect_HeEscaped = Resources.Load ("Prefabs/Effect_HeEscaped") as GameObject;
			effect_GameEnd = Resources.Load ("Prefabs/Effect_GameEnd") as GameObject; 
		}

		/// <summary>
		/// Play effect of game over.
		/// </summary>
		public void PlayEffectGameOver() {
			if (null != effect_HeEscaped) {
				GameObject go = Instantiate (effect_HeEscaped, Vector3.zero, Quaternion.identity) as GameObject;
				go.name = "HeEscaped";
			}
		}

		/// <summary>
		/// Plaies the effect game end.
		/// </summary>
		public void PlayEffectGameEnd() {
			if (null != effect_GameEnd) {
				GameObject go = Instantiate (effect_GameEnd, Vector3.zero, Quaternion.identity) as GameObject;
				go.name = "GameEnd";
			}
		}
	}
}