// Update is called once per frame
    void Update()
    {
        if (!autorun)
        {
            return;
        }



        if (state == ThoughtTextState.scaling1)
        {
            scale += scaleInSpeed * Time.deltaTime;
            if (scale > 1.15f)
            {
                state = ThoughtTextState.scaling2;
            }
            theTextMesh.transform.localScale = new Vector3(scale, scale, scale);
        }

        if (state == ThoughtTextState.scaling2)
        {
            scale -= (scaleInSpeed / 1.5f) * Time.deltaTime;
            if (scale < 1.0f)
            {
                scale = 1.0f;
                state = ThoughtTextState.idle;
            }

            theTextMesh.transform.localScale = new Vector3(scale, scale, scale);
        }

        if (state == ThoughtTextState.idle)
        {
            elapsedTime += Time.deltaTime;

            if (elapsedTime > timeToFadeOut)
            {
                state = ThoughtTextState.fading;
            }
        }

        if (state == ThoughtTextState.fading)
        {
            opacity -= fadeOutSpeed * Time.deltaTime;
            if (opacity < 0)
            {
                Destroy(this.gameObject);
            }
            else
            {
                Vector4 newCol = new Vector4(1, 1, 1, opacity);
                theTextMesh.color = newCol;
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     if (started)
     {
         return;
     }
     started     = true;
     theTextMesh = this.GetComponent <TextMesh> ();
     elapsedTime = 0.0f;
     state       = ThoughtTextState.scaling1;
     opacity     = 1.0f;
     scale       = 0.0f;
     theTextMesh.transform.localScale = new Vector3(0, 0, 0);
 }