using UnityEngine;
using System.Collections;

public class CloudEffectUI : MonoBehaviour {

	private Animator myAnim;

	void Awake()
	{
		myAnim = GetComponent<Animator>();
	}

	#region Message Event Listeners
	void OnEnable()
	{
		EventManager.StartListening(Constants.GenerateCombo, PlayNewCloud);
		EventManager.StartListening(Constants.CombinationFailed, PlayFailCloud);
		EventManager.StartListening(Constants.CombinationSuccessful, PlaySuccessCloud);
	}

	void OnDisable()
	{
		EventManager.StopListening(Constants.CombinationFailed, PlayFailCloud);
		EventManager.StopListening(Constants.CombinationSuccessful, PlaySuccessCloud);
		EventManager.StopListening(Constants.GenerateCombo, PlayNewCloud);
	}
	#endregion

	void PlayNewCloud()
	{
		myAnim.Play("NewCloud");
	}
	void PlayFailCloud()
	{
		myAnim.Play("FailCloud");
	}
	void PlaySuccessCloud()
	{
		myAnim.Play("SuccessCloud");
	}
}
