// Para que el jugador vea los efectos de su movimiento antes del cambio de cámara
    // hacemos una pausa y movemos la cámara
    IEnumerator Pausa()
    {
        Quaternion rotacion;

        yield return(new WaitForSeconds(0.4f));

        if (ControlTurno.GetTurnoJugador() == 0)
        {
            ControlTurno.SetTurnoJugador(1);
            rotacion = Quaternion.Euler(130, 0, 180);
            GameObject.Find("Main Camera").transform.position = new Vector3(0, 7, 7);
            GameObject.Find("Main Camera").transform.rotation = rotacion;
        }
        else
        {
            ControlTurno.SetTurnoJugador(0);
            rotacion = Quaternion.Euler(50, 0, 0);
            GameObject.Find("Main Camera").transform.position = new Vector3(0, 7, -6);
            GameObject.Find("Main Camera").transform.rotation = rotacion;
        }
    }
Example #2
0
    // Al iniciar pone las fichas y banderas con los elementos correspondientes si ya se habían seleccionado
    void Start()
    {
        // Desactivamos el panel de victoria
        IniciaPartida.panelVictoria = GameObject.Find("Fondo");
        IniciaPartida.panelVictoria.SetActive(false);
        IniciaPartida.estaPausado = 0;

        // Desactivamos el panel de Salir
        IniciaPartida.panelSalir = GameObject.Find("FondoSalir");
        IniciaPartida.panelSalir.SetActive(false);

        GameObject bandera = null;

        GameObject[] fichas = null;
        int[,,] datosFichas = new int[2, 9, 2];
        // Añadimos al array todas las fichas y la bandera del jugador 1

        datosFichas = FichaSeleccionada.GetFichasJugadores();
        FichaSeleccionada.SetCara(0);
        ControlTurno.SetTurnoJugador(0);
        fichas = GameObject.FindGameObjectsWithTag("FichasJugador1");
        foreach (GameObject ficha in fichas)
        {
            // recorremos todas las fichas asignando el elemento y añadiendo a las fichas seleccionadas
            if (datosFichas[ControlTurno.GetTurnoJugador(), (ficha.GetComponent <numFichaJugador>().idFicha) - 1, FichaSeleccionada.GetCara()] == 1)
            {
                CambiaObjeto.AsignaFuegoBlanco(ficha);
            }

            if (datosFichas[ControlTurno.GetTurnoJugador(), (ficha.GetComponent <numFichaJugador>().idFicha) - 1, FichaSeleccionada.GetCara()] == 2)
            {
                CambiaObjeto.AsignaAguaBlanca(ficha);
            }

            if (datosFichas[ControlTurno.GetTurnoJugador(), (ficha.GetComponent <numFichaJugador>().idFicha) - 1, FichaSeleccionada.GetCara()] == 3)
            {
                CambiaObjeto.AsignaMaderaBlanca(ficha);
            }
            this.InicializaFicha(ficha, datosFichas);
        }
        bandera = GameObject.FindGameObjectWithTag("BanderaJugador1");
        bandera.GetComponent <MoverBandera>().SetCasillaBandera(5);

        // Añadimos al array todas las fichas y la bandera del jugador 2
        ControlTurno.SetTurnoJugador(1);
        fichas = GameObject.FindGameObjectsWithTag("FichasJugador2");
        //datosFichas = FichaSeleccionada.GetFichasJugadores();
        foreach (GameObject ficha in fichas)
        {
            // recorremos todas las fichas asignando el elemento y añadiendo a las fichas seleccionadas
            if (datosFichas[ControlTurno.GetTurnoJugador(), (ficha.GetComponent <numFichaJugador>().idFicha) - 1, FichaSeleccionada.GetCara()] == 1)
            {
                CambiaObjeto.AsignaFuegoNegro(ficha);
            }

            if (datosFichas[ControlTurno.GetTurnoJugador(), (ficha.GetComponent <numFichaJugador>().idFicha) - 1, FichaSeleccionada.GetCara()] == 2)
            {
                CambiaObjeto.AsignaAguaNegra(ficha);
            }

            if (datosFichas[ControlTurno.GetTurnoJugador(), (ficha.GetComponent <numFichaJugador>().idFicha) - 1, FichaSeleccionada.GetCara()] == 3)
            {
                CambiaObjeto.AsignaMaderaNegra(ficha);
            }
            this.InicializaFicha(ficha, datosFichas);
        }
        bandera = GameObject.FindGameObjectWithTag("BanderaJugador2");
        bandera.GetComponent <MoverBandera>().SetCasillaBandera(20);

        // Preparamos el tueno y el botón de giro
        ControlTurno.SetTurnoJugador(0);
        MoverFicha.DesactivarGiro();
    }