[quote author=ochoag" data-ipsquote-contapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentclass="forums_Topic" data-ipsquote-contentid="35429" data-ipsquote-contentcommentid="128354">
bool _isWon;
bool _isLost; void Update ()
{
if (LevelManager.Instance.IsLevelRunning && (_isWon || _isLost))
{
Assert.IsTrue(LevelManager.IsActive, "Please ensure that you have a LevelManager component added to your scene.");
Assert.IsTrue(GameOver.IsActive, "Please ensure that you have a GameOver component added to your scene, or are using one of the default GameOver prefabs."); LevelManager.Instance.LevelFinished();
GameOver.Instance.Show(_isWon);
}
}or void Update ()
{
if (LevelManager.Instance.IsLevelRunning && (_isWon || _isLost))
{
Assert.IsTrue(LevelManager.IsActive, "Please ensure that you have a LevelManager component added to your scene.");
Assert.IsTrue(GameOver.IsActive, "Please ensure that you have a GameOver component added to your scene, or are using one of the default GameOver prefabs."); LevelManager.Instance.LevelFinished();
GameOver.Instance.Show(_isLost);
}
}
Todo para llamar que el juego se ha perdido o ganado pero en mi funcion Javascript GameState yo solo lo que quiero es agregar esto: function Update ()
{
if(vida <=0)
{
aqui con se ha perdido
} if(timer <=0 && puntos >= 50)
{
aqui cuando se ha ganado
}
if(timer <=0 && puntos < 50)
{
aqui cuando se ha perdido
}
print("Puntuacion: "+puntos);
print ("Vidas: "+vida);
}Alguien me puede ayudar en esa parte???...He estado investigando pero no he encontrado una solución para mi problema.[/quote]creo que esto te puede servirpublic float vida;
public float maxVida;
public void gameOver()
{
if(vida <= 0)
{
//Has Perdido
}
}
public int puntos;
public int puntosParaGanar;
public void Ganar()
{
if (puntos >= puntosParaGanar)
{
//Has Ganado
}
}void Update ()
{
if (LevelManager.Instance.IsLevelRunning && (_isWon || _isLost))
{ if(puntos >= puntosParaGanar){
Assert.IsTrue(LevelManager.IsActive, "Please ensure that you have a LevelManager component added to your scene.");
}else{ if(vida <= o){ Assert.IsTrue(GameOver.IsActive, "Please ensure that you have a GameOver component added to your scene, or are using one of the default GameOver prefabs."); LevelManager.Instance.LevelFinished();
GameOver.Instance.Show(_isLost); }
} }
}
Título: Necesito mandar llamar una funcion C# a mi JavaScript
Publicado por: isai en Marzo 22, 2016, 01:00:07 AM
revisa esto, ahi esta un ejemplo de como resolver tu problemahttp://forum.unity3d.com/threads/calling-a-c-function-from-javascript.34061/ (http://forum.unity3d.com/threads/calling-a-c-function-from-javascript.34061/)
jamas he podido hacer eso akkaka gracias por el link,como no podia llamar una funcion de js desde C#, lo hice mediante animation , jajajajaGracias revisa esto, ahi esta un ejemplo de como resolver tu problema
Sólo texto | Texto con Imágenes