예제 #1
0
 public FonctionNumTest()
 {
     Numeric[] val1 = new Numeric[1];
     Numeric[] val2 = new Numeric[2];
     val1[0] = new Numeric("9");
     val2[0] = new Numeric("9");
     val2[1] = new Numeric("2");
     ab      = new Absolu(val1);
     ar      = new Arrondi(val1);
     moy     = new Moyenne(val2);
     p       = new Puissance(val2);
     r       = new Racine(val1);
     at      = new Atan(val1);
     cos     = new Cosinus(val1);
     tan     = new Tangente(val1);
     tod     = new ToDegree(val1);
     tor     = new ToRadiant(val1);
 }
예제 #2
0
        public void Test1(string input, string output)
        {
            var textWriter = new StringWriter();

            Console.SetOut(textWriter);
            var file = File.ReadAllText(input);

            Console.SetIn(new StringReader(file));
            Puissance.MyMain(null);

            var expected = File.ReadAllText(output).Replace("\r\n", "\n");

            if (!expected.EndsWith("\n"))
            {
                expected = expected + "\n";
            }
            var actual = textWriter.ToString().Replace("\r\n", "\n");

            Assert.Equal(expected, actual);
        }
예제 #3
0
        private IEnumerator SetUpVisuelRoutine()
        {
            // Récupération de tous les attributs à changer.
            GameObject Nom;
            GameObject Puissance;
            GameObject TexteCarte;
            // Cout AKA ou rang pour les sorts.
            GameObject CoutAKA;

            GameObject FondCarte;

            while (GetComponent <Carte>().Name.Length <= 1)
            {
                // On attend l'arrivée des informations
                yield return(new WaitForSeconds(0.1f));
            }

            // On vérifie que tous les objets existent bien.
            try {
                Nom        = transform.Find("Name").gameObject;
                Puissance  = transform.Find("Puissance").gameObject;
                TexteCarte = transform.Find("TextCarte").gameObject;
                CoutAKA    = transform.Find("CoutAKA").gameObject;
                FondCarte  = transform.Find("FondCarte").gameObject;
            }
            catch (NullReferenceException) {
                Debug.LogError("Les objets enfants sont introuvables.\n Impossible de créer les attributs de carte");
                Destroy(this);
                yield break;
            }

            // On réactive les composants dans le cas où ils auraient été désactivés
            // Dans le cas d'un déplacement de l'adversaire par exemple
            Nom.SetActive(true);
            Puissance.SetActive(true);
            TexteCarte.SetActive(true);
            CoutAKA.SetActive(true);

            Nom.GetComponent <TextMesh>().text = SetUpString(GetComponent <Carte>().Name, 25);

            // Mise en place de la puissance de la carte. (/niveau pour les sorts).
            if (GetComponent <Carte>().IsEntite())
            {
                Puissance.GetComponent <TextMesh>().text = GetComponent <Entite>().getPuissance().ToString();
            }
            else if (GetComponent <Carte>().IsAssistance())
            {
                Puissance.GetComponent <TextMesh>().text = GetComponent <Assistance>().Puissance.ToString();
            }
            // Equivalent de la puissance pour les sorts => Niveau.
            else if (GetComponent <Carte>().IsSort())
            {
                Puissance.GetComponent <TextMesh>().text = GetComponent <Sort>().Niveau.ToString();
            }
            else
            {
                // Sinon on desative le TextMesh (ne devrait pas arriver normalement).
                Puissance.SetActive(false);
            }

            // Cout en AKA
            if (GetComponent <Carte>().IsEntite())
            {
                CoutAKA.GetComponent <TextMesh>().text = GetComponent <Entite>().CoutAKA.ToString();
            }
            else if (GetComponent <Carte>().IsSort())
            {
                CoutAKA.GetComponent <TextMesh>().text = GetComponent <Sort>().Rang.ToString();
            }
            else
            {
                CoutAKA.SetActive(false);
            }

            // Mise en place du texte de la carte.
            // A afficher en jeu? (si trop de texte).
            TexteCarte.GetComponent <TextMesh>().text = SetUpString(GetComponent <Carte>().GetInfoCarte(), 25);


            // On fait des vérifications dans l'éditeur.
#if (UNITY_EDITOR)
            if (!CheckTailleCarte())
            {
                Debug.LogError("Probleme avec le format de la carte");
            }
#endif

            FondCarte.GetComponent <SpriteRenderer>().color = GetCouleurCarte();

            VisuelOK = true;
        }