Ejemplo n.º 1
0
 //Loohy
 public MoteurGraphique(int longueur_, int largeur_)
 {
     longueur = longueur_;
     largeur = largeur_;
     camerax = 0;
     cameray = 0;
     direction = 0;
     flammiches = 0;
     int compteur1 = 0;
     int compteur2 = 0;
     r = new Random();
     pvOrNot = false;
     map = new Tile[longueur, largeur];
     while (compteur1 < longueur)
     {
         while (compteur2 < largeur)
         {
             map[compteur1, compteur2] = new Tile(compteur1, compteur2);
             compteur2++;
         }
         compteur1++;
         compteur2 = 0;
     }
     mapAleaGlace(longueur_, largeur_, 4, 4, 4);
     //if (r.Next(100) % 2 == 0)
     //{
     //    mapAleaFaceToFace(32, 32, 3, 3, 2);
     //}
     //else
     //{
     //    mapAleaFaceToFaceGlace(32, 32, 1, 3, 8);
     //}
     fog = e_brouillardDeGuerre.ToutVisible;
     sourisI = 0;
     sourisJ = 0;
     //Aplatir();
 }
Ejemplo n.º 2
0
 public void Afficher(Tile tile_, SystemeDeJeu gameplay_)
 {
     tile_.pointeurUnite = numeroUnite;
     tile_.pointeurArmee = numeroArmee;
     tile_.textureUnite = image;
     tile_.presence = true;
     tile_.estAccessible = false;
     tile_.dessinTomb = false;
     tile_.pourcentageDePv = (100 * pvactuel) / pvmax;
     tile_.mouvUnite = mouvement;
     tile_.mouvUniteMax = (mouvement * 40) / mouvementmax;
     tile_.xpUnite = (xp);
     Anim += vitesseAnim;
     tile_.jDepart = jDepart;
     tile_.iDepart = iDepart;
     if (Anim > 1)
     {
         #region anim
         Anim = 0;
         switch (state)
         {
             case e_EtatAnim.mouvement1:
                 state = e_EtatAnim.mouvement2;
                 sousrect.Y = 0;
                 break;
             case e_EtatAnim.mouvement2:
                 state = e_EtatAnim.mouvement3;
                 sousrect.Y = 3 * 128;
                 break;
             case e_EtatAnim.mouvement3:
                 state = e_EtatAnim.repos1;
                 sousrect.Y = 0;
                 vitesseAnim = 0.025f;
                 break;
             case e_EtatAnim.repos1:
                 state = e_EtatAnim.repos2;
                 sousrect.Y = 128;
                 ivirtuel = i;
                 jvirtuel = j;
                 break;
             case e_EtatAnim.repos2:
                 state = e_EtatAnim.repos1;
                 sousrect.Y = 0;
                 break;
             default:
                 break;
         }
         #endregion
     }
     tile_.state = state;
     tile_.sousRectUnite = sousrect;
     tile_.AttaqOrNot = attaqOrNot;
     tile_.aura = profiteDuneAura;
     tile_.heros = typeUnite == e_typeUnite.Heros;
     tile_.cachette = e_Cache.Visible;
     if (estInvisible)
     {
         if (gameplay_.tourencours == numeroArmee)
         {
             tile_.cachette = e_Cache.InvisibleAmi;
         }
         else
         {
             tile_.cachette = e_Cache.Invisible;
         }
     }
 }
Ejemplo n.º 3
0
 public void mapreseau()
 {
     map = new Tile[32, 32];
     for (int p = 0; p < 32; p++)
     {
         for (int q = 0; q < 32; q++)
         {
             map[p, q] = new Tile(p, q);
             map[p, q].altitude -= 7;
         }
     }
     montagneReguliere(16, 16);
     montagneReguliere(10, 20);
     montagneReguliere(20, 20);
     montagneReguliere(20, 10);
     montagneReguliere(10, 10);
     #region sol(altitude)
     for (int p = 0; p < 32; p++)
     {
         for (int q = 0; q < 32; q++)
         {
             if (map[p, q].altitude < 0)
             {
                 map[p, q].altitude = 0;
                 map[p, q].E_Sol = e_Typedesol.mer;
                 map[p, q].estAccessible = false;
             }
             else
             {
                 if (map[p, q].altitude < 8)
                 {
                     map[p, q].altitude = 0;
                     map[p, q].E_Sol = e_Typedesol.sable;
                 }
             }
         }
     }
     #endregion
     Adapt();
 }
Ejemplo n.º 4
0
        //Loohy
        public void mapDef()
        {
            map = new Tile[32, 32];
            for (int p = 0; p < 32; p++)
            {
                for (int q = 0; q < 32; q++)
                {
                    map[p, q] = new Tile(p, q);
                    map[p, q].altitude -= 10;
                }
            }

            for (int z = 0; z < 10; z++)
            {
                foret(z + 5, 10);
            }

            ruines(15, 4);

            viderVue();
        }
Ejemplo n.º 5
0
 public void mapAleaHerbe(int i_, int j_, int nombreDeMontagne_,
     int nombreDeForet_, int nombreDeRivieres_)
 {
     int a1 = r.Next(100) % i_;
     int b1 = r.Next(100) % j_;
     int a2 = r.Next(100) % i_;
     int b2 = r.Next(100) % j_;
     longueur = i_;
     largeur = j_;
     map = new Tile[i_, j_];
     for (int p = 0; p < i_; p++)
     {
         for (int q = 0; q < j_; q++)
         {
             map[p, q] = new Tile(p, q);
             map[p, q].altitude -= 10;
         }
     }
     for (int z = 0; z < nombreDeMontagne_; z++)
     {
         montagne(r.Next(100) % i_, r.Next(100) % j_);
     }
     #region sol(altitude)
     for (int p = 0; p < i_; p++)
     {
         for (int q = 0; q < j_; q++)
         {
             if (map[p, q].altitude < 0)
             {
                 map[p, q].altitude = 0;
                 map[p, q].E_Sol = e_Typedesol.mer;
                 map[p, q].estAccessible = false;
             }
             else
             {
                 if (map[p, q].altitude < 8)
                 {
                     map[p, q].E_Sol = e_Typedesol.sable;
                 }
             }
         }
     }
     #endregion
     for (int z = 0; z < nombreDeRivieres_; z++)
     {
         while (map[a1, b1].E_Sol == e_Typedesol.sable && map[a1, b1].altitude < 20)
         {
             a1 = r.Next(100) % i_;
             b1 = r.Next(100) % j_;
         }
         river(a1, b1);
         a1 = r.Next(100) % i_;
         b1 = r.Next(100) % j_;
     }
     for (int z = 0; z < 4; z++)
     {
         a1 = r.Next(100) % i_;
         b1 = r.Next(100) % j_;
         a2 = r.Next(100) % i_;
         b2 = r.Next(100) % j_;
         if (bunker(a1, b1) && bunker(a2, b2))
         {
             roadTo(a1, b1, a2, b2);
         }
     }
     for (int z = 0; z < nombreDeForet_; z++)
     {
         foret(r.Next(100) % i_, r.Next(100) % j_);
     }
     for (int z = 0; z < r.Next(100) % 8; z++)
     {
         ruines(r.Next(100) % i_, r.Next(100) % j_);
     }
     for (int p = 0; p < i_; p++)
     {
         for (int q = 0; q < j_; q++)
         {
             map[p, q].Adapt(this, r.Next(100) / 10);
         }
     }
     viderVue();
 }
Ejemplo n.º 6
0
 public void mapAleaFaceToFaceGlace(int i_, int j_, int nombreDeMontagne_, int nombreDeForet_, int nombreDeRivieres_)
 {
     int a1 = i_ / 4;
     int b1 = j_ / 4;
     int a2 = 3 * (i_ / 4);
     int b2 = 3 * (j_ / 4);
     int a3, b3;
     longueur = i_;
     largeur = j_;
     map = new Tile[i_, j_];
     for (int p = 0; p < i_; p++)
     {
         for (int q = 0; q < j_; q++)
         {
             map[p, q] = new Tile(p, q);
             map[p, q].altitude -= 7;
             map[p, q].E_Sol = e_Typedesol.neige;
         }
     }
     for (int z = 0; z < nombreDeMontagne_; z++)
     {
         montagne(r.Next(100) % i_, r.Next(100) % j_);
     }
     montagne(a1, b1);
     montagne(a2, b2);
     #region sol(altitude)
     for (int p = 0; p < i_; p++)
     {
         for (int q = 0; q < j_; q++)
         {
             if (map[p, q].altitude < 0)
             {
                 map[p, q].altitude = 0;
                 map[p, q].E_Sol = e_Typedesol.mer;
                 map[p, q].estAccessible = false;
             }
             else
             {
                 if (map[p, q].altitude < 8)
                 {
                     map[p, q].E_Sol = e_Typedesol.banquise;
                 }
             }
         }
     }
     #endregion
     icebunker(a1, b1);
     icebunker(a2, b2);
     for (int z = 0; z < nombreDeRivieres_; z++)
     {
         while (map[a1, b1].E_Sol == e_Typedesol.banquise && map[a1, b1].altitude < 20)
         {
             a3 = r.Next(100) % i_;
             b3 = r.Next(100) % j_;
         }
         river(a1, b1);
         a3 = r.Next(100) % i_;
         b3 = r.Next(100) % j_;
     }
     roadTo(a1, b1, a2, b2);
     for (int z = 0; z < nombreDeForet_; z++)
     {
         foret(r.Next(100) % i_, r.Next(100) % j_);
     }
     for (int z = 0; z < 3; z++)
     {
         VillagePingvin(r.Next(100) % i_, r.Next(100) % j_);
     }
     for (int z = 0; z < r.Next(100) % 8; z++)
     {
         ruines(r.Next(100) % i_, r.Next(100) % j_);
     }
     Adapt();
     viderVue();
 }
Ejemplo n.º 7
0
 public void mapAleaDesert(int i_, int j_)
 {
     longueur = i_;
     largeur = j_;
     List<Vector2> villes = new List<Vector2>();
     map = new Tile[i_, j_];
     for (int p = 0; p < i_; p++)
     {
         for (int q = 0; q < j_; q++)
         {
             map[p, q] = new Tile(p, q);
             map[p, q].E_Sol = e_Typedesol.desert;
             map[p, q].altitude = r.Next(100) % 15;
         }
     }
     villes.Add(new Vector2(longueur / 4, largeur / 4));
     villes.Add(new Vector2((2 * longueur) / 4, largeur / 4));
     villes.Add(new Vector2((2 * longueur) / 4, (2 * largeur) / 4));
     villes.Add(new Vector2(longueur / 4, (2 * largeur) / 4));
     for (int z = 0; z < 5; z++)
     {
         villes.Add(new Vector2(r.Next(100) % longueur, r.Next(100) % largeur));
     }
     for (int k = 0; k < villes.Count; k++)
     {
         switch (r.Next(100) % 3)
         {
             case 0:
                 bunker((int)villes[k].X, (int)villes[k].Y);
                 break;
             default:
                 VillageKrissa((int)villes[k].X, (int)villes[k].Y);
                 break;
         }
         roadTo((int)villes[k].X, (int)villes[k].Y,
             (int)villes[(k + 1) % villes.Count].X, (int)villes[(k + 1) % villes.Count].Y);
     }
     Adapt();
 }
Ejemplo n.º 8
0
 //Loohy
 public void NEW(int x_, int y_)
 {
     map = new Tile[x_, y_];
     for (int i = 0; i < x_; i++)
     {
         for (int j = 0; j < y_; j++)
         {
             map[i, j] = new Tile(i, j);
             map[i, j].visible = true;
         }
     }
     Adapt();
     centrerSur(x_ / 2, y_ / 2);
 }