var mensaje : UI.Text;
var cuadro : GameObject;
var texto1 : String;
var player : GameObject;
var texto2 : String;
var letra : int;
var fin = ;
private var texto : String;
var playerSentado : GameObject;
function Start () {
Empezar();
}
function Update () {
}
function Empezar (){
if(fin == ){texto = texto1 +player.name + texto2;}
if(fin == 1){texto = "Dialogo 2";}
//texto = texto1 +player.name + texto2;
StartCoroutine(dictado(texto));
}
function dictado (frase : String){
mensaje.text ="";
while ( letra < frase.length){
mensaje.text += frase[letra];
letra += 1;
yield WaitForSeconds(0.2f);
}
while ( letra >= frase.length){
yield WaitForSeconds(0.2f);
mensaje.text = "";
yield WaitForSeconds(1f);
//cuadro.SetActive(false);
player.SetActive(true);
playerSentado.SetActive(false);
texto = "";
frase = "";
letra = ;
fin = 1;
print(frase.Length);
Empezar();
}
}
while ( letra >= frase.length)
if ( letra >= frase.length)
var mensaje : UI.Text;
var cuadro : GameObject;
var texto1 : String;
var player : GameObject;
var texto2 : String;
var letra : int;
var fin = 0;
private var texto : String;
var playerSentado : GameObject;
function Start () {
Empezar();
}
function Update () {
}
function Empezar (){
if(fin == 0){texto = texto1 +player.name + texto2;}
if(fin == 1){texto = "Dialogo 2";}
//texto = texto1 +player.name + texto2;
StartCoroutine(dictado(texto));
}
function dictado (frase : String){
mensaje.text ="";
while ( letra < frase.length){
mensaje.text += frase[letra];
letra += 1;
yield WaitForSeconds(0.2f);
}
while ( letra >= frase.length){
yield WaitForSeconds(0.2f);
mensaje.text = "";
yield WaitForSeconds(1f);
//cuadro.SetActive(false);
player.SetActive(true);
playerSentado.SetActive(false);
"yield return StartCoruotine(....)"// ejemplo
fin = 1;
print(frase.Length);
Empezar();
}
}
Cita de: Eyemdy date=1510236194entonces si pusiera esto en el segundo while