Пример #1
0
    // Update is called once per frame
    void Update()
    {
        contador++;
        if (finDelJuego)
        {
            mensaje("FIN DEL JUEGO");
        }

        if (eJuego == estadoJuego.simula && contador % 20 == 0 && !finDelJuego)
        {
            if (turn == turno.turnoZombie)
            {
                turnoZombie();
                turn = turno.lucha1;
            }
            else if (turn == turno.lucha1)
            {
                lucha();
                actualizaZombisSoldados();
                turn = turno.turnoHeroe;
            }
            else if (turn == turno.turnoHeroe)
            {
                turnoHeroe();
                turn = turno.lucha2;
            }
            else if (turn == turno.lucha2)
            {
                lucha();
                actualizaZombisSoldados();
                turn = turno.turnoZombie;
            }
            if (nZombies == 0)
            {
                heroeEstado = estadoHeroe.huir;
            }
            mensaje("nZombies: " + nZombies + " nSoldados: " + nSoldados);
            Resultado.text = ("Resultado: " + puntuacion);
            contador       = 0;
        }
        if (Input.GetKey("escape"))
        {
            Application.Quit();
        }
    }
Пример #2
0
 public void turnoHeroe()
 {
     if (estadoHeroe.normal == heroeEstado)
     {
         int decision = MakeDecision();
         if (decision == 0)              //Matar
         {
             matar();
         }
         else if (decision == 1)                // Huir
         {
             heroeEstado = estadoHeroe.huir;
             print("huir");
         }
     }
     else
     {
         goHome();
     }
 }