示例#1
0
    public void SiguienteTurno()
    {
        Turno aux      = turnosJugadores.Dequeue();
        float relation = 1920.0f / (float)Screen.width;

        aux.transform.position += new Vector3((turnosJugadores.Count + 1) * 120 / relation, 0, 0);
        aux.DesctivarTexto();
        turnosJugadores.Enqueue(aux);

        foreach (var t in turnosJugadores)
        {
            t.Deslizar();
        }
        turnosJugadores.Peek().ActivarTexto();

        // gestionamos los jugadores muertos, para calaveras y para ver si acabamos la partida
        // aliados
        bool todosMuertos = true;

        for (int i = 0; i < nJugadoresPorEquipo; i++)
        {
            if (aliados[i].EstaMuerto())
            {
                foreach (var x in turnosJugadores)
                {
                    if (x.GetId() == i)
                    {
                        x.PonerCalavera();
                    }
                }
            }
            else
            {
                todosMuertos = false;
            }
        }
        if (todosMuertos)
        {
            if (gm.IsAliado())
            {
                menuGameOver.SetActive(true);
            }
            else
            {
                menuVictory.SetActive(true);
            }
            return;
        }

        todosMuertos = true;
        // enemigos
        for (int i = 0; i < nJugadoresPorEquipo; i++)
        {
            if (enemigos[i].EstaMuerto())
            {
                foreach (var x in turnosJugadores)
                {
                    if (x.GetId() == i + nJugadoresPorEquipo)
                    {
                        x.PonerCalavera();
                    }
                }
            }
            else
            {
                todosMuertos = false;
            }
        }
        if (todosMuertos)
        {
            if (gm.IsAliado())
            {
                menuVictory.SetActive(true);
            }
            else
            {
                menuGameOver.SetActive(true);
            }
        }
    }