Example #1
0
    public void ValidateAndGoToGame()
    {
        bool            errorControls    = false;
        CharacterSelect problemCharacter = null;

        if (instance.allChara.Count % 2 != 0)
        {
            SetErrorMessage("Le nombre de joueur dans chaque équipe n'est pas le même !");
            return;
        }

        foreach (CharacterSelect c in instance.allChara)
        {
            if (c.GetInfos().GetControls().GetName() == PlayerControls.VIDE)
            {
                errorControls    = true;
                problemCharacter = c;
            }
        }

        if (errorControls)
        {
            SetErrorMessage("Le joueur " + (problemCharacter.GetSlot() + 1) + " n'a pas de controles");
            return;
        }


        foreach (CharacterSelect c in instance.allChara)
        {
            VariablesGlobales.AddToPlayers(c.GetInfos());
            Debug.Log("Add global " + c.GetInfos().GetControls().GetName());
        }
        instance.allChara = new List <CharacterSelect>();
        mainMenu.PlayGame();
    }