using UnityEngine;
using System.Collections;

public class TriggerAnimation : MonoBehaviour {

	#region Private Variables
	private Animator _anim;

	[SerializeField]
	private float _destroyAfter = -1f;
	#endregion


	#region Events
	void Awake () {

		_anim = GetComponent <Animator> ();

	}
	#endregion


	#region Methods
	public void Trigger () {
		
		_anim.SetTrigger ("Show");

		if (_destroyAfter > -1f)
		Invoke ("RemoveAnimator", _destroyAfter);

	}

	void RemoveAnimator () {

		Destroy (_anim);

	}
	#endregion

}
