Beispiel #1
0
    /// <summary>
    /// Reset la phase d'activation
    /// </summary>
    public void ResetPhaseActivation()
    {
        //Variables pour le joueur 1
        J1CartesNonVerif.Clear();
        J1CarteVerif = null;
        RedPlayerPanel.SetActive(true);
        ConfirmPanelRed.SetActive(false);
        HasConfirmedPanelRed.SetActive(false);
        J1Choix = true;
        J1Verif = false;

        J1DernièreValeurActivation = 0f;
        _j1CarteChoisie            = false;

        //Variables pour le joueur 2
        J2CarteVerif = null;
        J2CartesNonVerif.Clear();
        BluePlayerPanel.SetActive(true);
        ConfirmPanelBlue.SetActive(false);
        HasConfirmedPanelBlue.SetActive(false);
        J2Choix = true;
        J2Verif = false;

        J2DernièreValeurActivation = 0f;
        _j2CarteChoisie            = false;

        UIInstance.Instance.BackgroundActivation.SetActive(true);

        _result.SetActive(false);
    }
Beispiel #2
0
    void Update()
    {
        if (_canChooseCard)
        {
            //Joueur 1
            if (!_j1CarteChoisie)
            {
                //On vérifie si le joueur 1 choisit sa carte
                if (J1Verif && Input.GetKeyDown(J1CarteVerif.inputCarteActivation))
                {
                    foreach (CarteActivation Carteactivations in RedCartesActivation)
                    {
                        Debug.Log("Confirm Red Card");
                        ConfirmPanelRed.SetActive(false);
                        HasConfirmedPanelRed.SetActive(true);
                    }

                    J1DernièreValeurActivation = float.Parse(J1CarteVerif.valeurActivation) / 10;
                    CarteActivationUtilisée.Add(J1CarteVerif);
                    RedCartesActivation.Clear();

                    foreach (CarteActivation carteactivations in J1CartesNonVerif)
                    {
                        RedCartesActivation.Add(carteactivations);
                    }

                    //Le joueur 1 a choisit sa carte
                    _j1CarteChoisie = true;
                    if (CheckIfBothPlayerHasChoose())
                    {
                        ShowResult();
                    }

                    J1Verif = false;
                }

                else if (J1Verif)
                {
                    if (Input.anyKeyDown)
                    {
                        foreach (CarteActivation Carteactivation in J1CartesNonVerif)
                        {
                            if (Input.GetKeyDown(Carteactivation.inputCarteActivation))
                            {
                                J1Choix = true;
                                J1Verif = false;
                                Debug.Log("Changed choose card");
                                ConfirmPanelRed.SetActive(false);
                            }
                        }
                    }
                }

                //Check si le joueur appuie une première fois sur une touche
                else if (J1Choix)
                {
                    if (Input.anyKey)
                    {
                        J1CarteVerif = null;
                        J1CartesNonVerif.Clear();

                        foreach (CarteActivation carteactivation in RedCartesActivation)
                        {
                            if (Input.GetKeyDown(carteactivation.inputCarteActivation))
                            {
                                foreach (CarteActivation carteactivations in RedCartesActivation)
                                {
                                    Debug.Log("Choose Red Card");
                                    ConfirmPanelRed.SetActive(true);
                                    J1CarteVerif = carteactivation;
                                    if (carteactivations == J1CarteVerif)
                                    {
                                    }
                                    else if (carteactivations != J1CarteVerif)
                                    {
                                        J1CartesNonVerif.Add(carteactivations);
                                    }
                                }
                                J1Verif = true;
                                J1Choix = false;
                            }
                        }
                    }
                }
            }

            //Meme principe que pour le joueur 1 mais avec les variables que le joueur 2
            if (!_j2CarteChoisie)
            {
                if (J2Verif && Input.GetKeyDown(J2CarteVerif.inputCarteActivation))
                {
                    foreach (CarteActivation Carteactivations in BlueCartesActivation)
                    {
                        Debug.Log("Confirm Blue Card");
                        ConfirmPanelBlue.SetActive(false);
                        HasConfirmedPanelBlue.SetActive(true);
                    }

                    J2DernièreValeurActivation = float.Parse(J2CarteVerif.valeurActivation) / 10;
                    CarteActivationUtilisée.Add(J2CarteVerif);
                    BlueCartesActivation.Clear();

                    foreach (CarteActivation carteactivations in J2CartesNonVerif)
                    {
                        BlueCartesActivation.Add(carteactivations);
                    }

                    //Le joueur 2 a choisit sa carte
                    _j2CarteChoisie = true;
                    if (CheckIfBothPlayerHasChoose())
                    {
                        ShowResult();
                    }

                    J2Verif = false;
                }
                else if (J2Verif)
                {
                    foreach (CarteActivation Carteactivation in J2CartesNonVerif)
                    {
                        if (Input.GetKeyDown(Carteactivation.inputCarteActivation))
                        {
                            foreach (CarteActivation Carteactivations in BlueCartesActivation)
                            {
                                Debug.Log("Change card blue");
                                ConfirmPanelBlue.SetActive(false);
                            }
                            J2Choix = true;
                            J2Verif = false;
                        }
                    }
                }

                else if (J2Choix)
                {
                    J2CarteVerif = null;
                    J2CartesNonVerif.Clear();
                    foreach (CarteActivation carteactivation in BlueCartesActivation)
                    {
                        if (Input.GetKeyDown(carteactivation.inputCarteActivation))
                        {
                            foreach (CarteActivation carteactivations in BlueCartesActivation)
                            {
                                ConfirmPanelBlue.SetActive(true);
                                J2CarteVerif = carteactivation;
                                if (carteactivations == J2CarteVerif)
                                {
                                }
                                else if (carteactivations != J2CarteVerif)
                                {
                                    J2CartesNonVerif.Add(carteactivations);
                                }
                            }

                            J2Verif = true;
                            J2Choix = false;
                            Debug.Log("Choose Blue Card");
                        }
                    }
                }
            }
        }
    }