public void Load() { XmlDocument xmlDoc = new XmlDocument(); // xmlDoc is the new xml document. xmlDoc.LoadXml(GameAsset.text); // load the file. XmlNodeList enigmesList = xmlDoc.GetElementsByTagName("enigme"); // array of the level nodes. foreach (XmlNode node in enigmesList) { taille++; } TabEnigmes = new Enigme[taille]; taille = 0; foreach (XmlNode node in enigmesList) { TabEnigmes[taille] = new Enigme(); TabEnigmes[taille].name = node.SelectSingleNode("name").InnerText; TabEnigmes[taille].description = node.SelectSingleNode("description").InnerText; TabEnigmes[taille].Q1 = node.SelectSingleNode("Q1").InnerText; TabEnigmes[taille].Q2 = node.SelectSingleNode("Q2").InnerText; TabEnigmes[taille].Q3 = node.SelectSingleNode("Q3").InnerText; TabEnigmes[taille].Q4 = node.SelectSingleNode("Q4").InnerText; TabEnigmes[taille].bonneReponse = int.Parse(node.SelectSingleNode("bonneReponse").InnerText); print("enigme " + (taille + 1) + " chargé"); taille++; } }
public static void divise7(Enigme e) { if (e.clef == false) { e.setDifficulty(e.getDifficulty() / 7);; } }
public static void swap(Enigme e1, Enigme e2) { if (e2.clef == true) { e2.clef = false; e1.clef = true; } }
//Try to open the door public static void tryDoor(Enigme e) { if (e.getDifficulty() == 0 && e.clef == true) { //Open the door Debug.Log("Door opened !"); Object.Destroy(GameObject.Find("Cailloux")); } }
public static CubeEnigmeObject creerCubeEnigme(Enigme e, Vector3 pos) { GameObject cube = (GameObject)Instantiate(Resources.Load("CubeEnigme"), pos, Quaternion.identity); var cubeEnigme = cube.GetComponent <CubeEnigmeObject>(); cubeEnigme.initialize(e); Logique.tableauDistance.Add(new TupleDistance(cubeEnigme.gameObject, 777)); //CubeIntObject cube = Instantiate(instance.CubeIntPrefab, Vector3.zero,Quaternion.identity).GetComponent<CubeIntObject>(); //cube.initialize(i); return(cubeEnigme); }
private void processBoutonNewEnigme() { GameObject zoneRes = this.transform.parent.gameObject.transform.Find("ZoneRes").gameObject; GameObject zoneP1 = this.transform.parent.gameObject.transform.Find("ZoneP1").gameObject; GameObject zoneP2 = this.transform.parent.gameObject.transform.Find("ZoneP2").gameObject; Debug.Log(zoneP1); Debug.Log(zoneP2); try { if (zoneP1.GetComponent <Zone>().go == null && zoneP2.GetComponent <Zone>().go == null) { Debug.Log("e0"); Enigme e0 = new Enigme(); CubeEnigmeObject cubeEnigme = GameObjectFactory.creerCubeEnigme(e0, spawnEnigmeVect); } else if ((zoneP1.GetComponent <Zone>().go == null && zoneP2.GetComponent <Zone>().go != null) || (zoneP1.GetComponent <Zone>().go != null && zoneP2.GetComponent <Zone>().go == null)) { Debug.Log("e1"); if (zoneP2.GetComponent <Zone>().go == null) { int P1 = zoneP1.GetComponent <Zone>().go.GetComponent <CubeIntObject>().cubeInt.entier; Enigme e1 = new Enigme(P1); CubeEnigmeObject cubeEnigme = GameObjectFactory.creerCubeEnigme(e1, spawnEnigmeVect); Debug.Log(cubeEnigme); } else { int P2 = zoneP2.GetComponent <Zone>().go.GetComponent <CubeIntObject>().cubeInt.entier; Enigme e1 = new Enigme(P2); CubeEnigmeObject cubeEnigme = GameObjectFactory.creerCubeEnigme(e1, spawnEnigmeVect); Debug.Log(cubeEnigme); } } else { Debug.Log("e2"); int P1 = zoneP1.GetComponent <Zone>().go.GetComponent <CubeIntObject>().cubeInt.entier; int P2 = zoneP2.GetComponent <Zone>().go.GetComponent <CubeIntObject>().cubeInt.entier; Enigme e2 = new Enigme(P1, P2); CubeEnigmeObject cubeEnigme = GameObjectFactory.creerCubeEnigme(e2, spawnEnigmeVect); Debug.Log(cubeEnigme); } } catch (System.Exception e) { Debug.Log(e); } }
private void InitListe() { int i = 0; lstEnigme = new List <Enigme>(); MySqlConnection con = sauv.con; MySqlDataReader reader; MySqlCommand command = con.CreateCommand(); command.CommandText = "SELECT * FROM enigmes"; reader = command.ExecuteReader(); while (reader.Read()) { Enigme eni = new Enigme(reader, i); lstEnigme.Add(eni); i++; } reader.Close(); }
public void ButtonClicked(string myTextString, int id) { // REF des énigmes textuelles: https://www.cabaneaidees.com/15-enigmes-faciles-pour-les-enfants/ // Mettre dans le START CanvasGroup CanvaAOuvrir = GameObject.FindGameObjectWithTag("cnv1").GetComponent <CanvasGroup>(); Text duTexte = GameObject.FindGameObjectWithTag("txtQuestion").GetComponent <Text>(); Dropdown choixItem3 = GameObject.FindGameObjectWithTag("listeReponses").GetComponent <Dropdown>(); Text txtBonus = GameObject.FindGameObjectWithTag("bonusEnigme").GetComponent <Text>(); // Initialiser le titre des choix possibles choixItem3.options.Add(new Dropdown.OptionData() { text = "Réponses possibles" }); choixItem3.value = choixItem3.options.Count - 1; choixItem3.options.RemoveAt(choixItem3.options.Count - 1); txtBonus.text = "Récompense : 30 exp."; enigmeSelectionee = _liste[id]; duTexte.name = enigmeSelectionee.id.ToString(); CanvaAOuvrir.alpha = 1; CanvaAOuvrir.blocksRaycasts = true; duTexte.text = enigmeSelectionee.question; choixItem3.options[0].text = enigmeSelectionee.choix1; choixItem3.options[1].text = enigmeSelectionee.choix2; choixItem3.options[2].text = enigmeSelectionee.choix3; /* * CanvasGroup puzzle1 = GameObject.FindGameObjectWithTag("puzzle1").GetComponent<CanvasGroup>(); * puzzle1.alpha = 1; * puzzle1.blocksRaycasts = true; */ }
public CubeEnigme(Enigme e) { this.enigme = e; difficulty = e.getDifficulty(); clef = e.clef; }
public void initialize(Enigme e) { cubeEnigme = new CubeEnigme(e); }
public void modifierEnigme() { Enigme monEnigme = _btnControl.enigmeSelectionee; inputNom.text = monEnigme.nom; }