Пример #1
0
    // Comprobamos que se hayan indicado los elementos de todas las fichas para habilitar el botón siguiente
    void Update()
    {
        int[,,] fichasjugador = null;
        int totalFichasAsignadas = 0;

        fichasjugador = FichaSeleccionada.GetFichasJugadores();

        for (int i = 0; i < 9; i++)
        {
            if (fichasjugador[FichaSeleccionada.GetJugador(), i, 0] > 0)
            {
                totalFichasAsignadas++;
            }
            if (fichasjugador[FichaSeleccionada.GetJugador(), i, 1] > 0)
            {
                totalFichasAsignadas++;
            }
        }

        if (totalFichasAsignadas > 17)
        {
            this.GetComponent <Button>().interactable = true;
        }
        else
        {
            this.GetComponent <Button>().interactable = false;
        }
    }
Пример #2
0
    // Al iniciar pone las fichas con los elementos correspondientes si ya se habían seleccionado
    void Start()
    {
        GameObject[] fichas = null;
        int[,,] datosFichas = null;
        // Añadimos al array todas las fichas del jugador 1
        if (FichaSeleccionada.GetJugador() == 0)
        {
            fichas      = GameObject.FindGameObjectsWithTag("FichasJugador1");
            datosFichas = FichaSeleccionada.GetFichasJugadores();
            foreach (GameObject ficha in fichas)
            {
                // recorremos todas las fichas asignando el elemento y añadiendo a las fichas seleccionadas
                if (datosFichas[FichaSeleccionada.GetJugador(), (ficha.GetComponent <numFichaJugador>().idFicha) - 1, FichaSeleccionada.GetCara()] == 1)
                {
                    CambiaObjeto.AsignaFuegoBlanco(ficha);
                }

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

                if (datosFichas[FichaSeleccionada.GetJugador(), (ficha.GetComponent <numFichaJugador>().idFicha) - 1, FichaSeleccionada.GetCara()] == 3)
                {
                    CambiaObjeto.AsignaMaderaBlanca(ficha);
                }
            }
        }
        // Añadimos al array todas las fichas del jugador 2
        if (FichaSeleccionada.GetJugador() == 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[FichaSeleccionada.GetJugador(), (ficha.GetComponent <numFichaJugador>().idFicha) - 1, FichaSeleccionada.GetCara()] == 1)
                {
                    CambiaObjeto.AsignaFuegoNegro(ficha);
                }

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

                if (datosFichas[FichaSeleccionada.GetJugador(), (ficha.GetComponent <numFichaJugador>().idFicha) - 1, FichaSeleccionada.GetCara()] == 3)
                {
                    CambiaObjeto.AsignaMaderaNegra(ficha);
                }
            }
        }
    }
Пример #3
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();
    }