using UnityEngine;
using System.Collections;

public class InGameTextScript : MonoBehaviour {

    float fLifeTime = 3.0f;
    TextMesh tm;

	// Use this for initialization
	void Start ()
    {
        tm = GetComponent<TextMesh>();
	}
	
	// Update is called once per frame
	void Update () 
    {
        Vector3 vPos = transform.position;
        vPos.y += 1.5f * Time.deltaTime;
        transform.position = vPos;

        fLifeTime -= Time.deltaTime;

        if( fLifeTime < 1.0f )
        {
            Color c = tm.color;
            c.a = fLifeTime / 1.0f;
            tm.color = c;
        }

        if (fLifeTime < 0.0f)
            Destroy(gameObject);
	}
}
