using UnityEngine;
using System.Collections;

public class SpriteEffect : MonoBehaviour {

	public float speed=1;

	SpriteRenderer spriteRD;

	// Use this for initialization
	void Start () {
		spriteRD = GetComponent<SpriteRenderer> ();
	}
	
	// Update is called once per frame
	void Update () {
		spriteRD.color = new Color (spriteRD.color.r, spriteRD.color.g, spriteRD.color.b, Mathf.MoveTowards (spriteRD.color.a, 0, speed * Time.deltaTime));
		if(spriteRD.color.a==0){
			Destroy(gameObject);
		}
	}
}
