void doAnim() { if(currentState == TextShowingState.TX_PLAYING) { playedTime += Time.deltaTime; if(textMesh != null) { float scale = playedTime * 2.0f / duration; if(scale > 1.0) { scale = 1.0f; } Vector3 newScale = maxLocalScale * scale; newScale.Set(newScale.x,newScale.y,maxLocalScale.z); transform.localScale = newScale; } if(playedTime > duration) { currentState = TextShowingState.TX_STOPPED; } } if(currentState == TextShowingState.TX_STOPPED) { transform.localScale = maxLocalScale * 0; } }
void resetState() { currentState = TextShowingState.TX_PLAYING; playedTime = 0; if(textMesh != null) { textMesh.text = stringToShow; textMesh.Commit(); } }