public void jouer()
 {
     proposition = new Proposition();
     int poidTotal=0;
     foreach (TypeDeBatiment b in batimentsDisponibles){
         poidTotal += b.poids;
     }
     System.Random rnd =new System.Random();
     int test = rnd.Next(0,poidTotal);
     TypeDeBatiment enCours = new TypeDeBatiment();
     while(test>0){
     foreach (TypeDeBatiment b in batimentsDisponibles){
         test -= b.poids;
             if (test<=0) {
                 proposition.addBatiment (new Batiment(b));
                 break;
             }
     }
     }
 }
        private void chargerUnEffet(XmlNode node, TypeDeBatiment b)
        {
            String type = node.SelectSingleNode ("Type").InnerText;
            Effet effet = null;

            if (type.Equals ("PRODUIRE")) {
                effet = new EffetProduire(node);

            }

            b.ajouterEffet(effet);
        }
        public void loadBatiments()
        {
            XmlDocument doc = new XmlDocument ();
            doc.Load (dataPath + "/Batiments.xml");
            XmlNodeList nodes = doc.DocumentElement.ChildNodes;
            foreach (XmlNode node in nodes) {
                TypeDeBatiment b = new TypeDeBatiment();
                b.poids = int.Parse (node.SelectSingleNode ("Poids").InnerText);
                b.niveau = int.Parse (node.SelectSingleNode ("Niveau").InnerText);
                b.nom = node.SelectSingleNode ("Nom").InnerText;
                b.description = node.SelectSingleNode ("Description_" + langage).InnerText;
                Debug.Log (node.SelectSingleNode ("Categorie").InnerText);
                if (node.SelectSingleNode ("Categorie").InnerText != "NULL") {
                    b.categorie = (CategoriesConseiller) Enum.Parse (typeof(CategoriesConseiller), node.SelectSingleNode ("Categorie").InnerText);
                }
                b.prefab = globalPrefabs.getPrefab(node.SelectSingleNode("Prefab").InnerText);

                //Chargement des effets
                XmlNodeList nodesEffet = node.SelectNodes("Effet");
                foreach (XmlNode nodeEffet in nodesEffet) {
                    Debug.Log("Je charge l'effet : " + nodeEffet.InnerText);
                    chargerUnEffet(nodeEffet,b);
                }

                typesDeBatiment.Add(b);
            }
        }
Ejemplo n.º 4
0
 public Batiment(TypeDeBatiment type, Case kase)
 {
     this.type = type;
     this.kase = kase;
 }
Ejemplo n.º 5
0
 public Batiment(TypeDeBatiment type)
 {
     this.type = type;
 }