// Para aumentar la cantidad de hijos cuando se reproduce public void Reproducirse(Mapa mapa) { mapa.CrearBitmon_Reproduccion(); cantidadDeHijos += 1; }
public Form1() { InitializeComponent(); matrizBotones = new Button[mapa.filas_mapa, mapa.columnas_mapa]; listaBotones = new List <Button>(); for (int fila = 0; fila < mapa.filas_mapa; fila++) { for (int columna = 0; columna < mapa.columnas_mapa; columna++) { Random random = new Random(); Button button = new Button(); button.Dock = DockStyle.Fill; button.Margin = new Padding(0, 0, 0, 0); button.Padding = new Padding(0, 0, 0, 0); button.FlatStyle = FlatStyle.Popup; button.FlatAppearance.BorderSize = 0; button.Enabled = false; tableLayoutPanel1.Controls.Add(button, columna, fila); matrizBotones[fila, columna] = button; listaBotones.Add(button); Celda celda = mapa.mapa[fila, columna]; Terreno terreno = celda.tipo_terreno; // Terrenos en el mapa if (terreno.Get_Terreno() == "acuatico") { matrizBotones[fila, columna].BackColor = Color.Blue; matrizBotones[fila, columna].BackgroundImage = Properties.Resources.fotoagua; matrizBotones[fila, columna].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; } else if (terreno.Get_Terreno() == "desierto") { matrizBotones[fila, columna].BackColor = Color.SandyBrown; matrizBotones[fila, columna].BackgroundImage = Properties.Resources.fotodesierto; matrizBotones[fila, columna].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; } else if (terreno.Get_Terreno() == "vegetacion") { matrizBotones[fila, columna].BackColor = Color.GreenYellow; matrizBotones[fila, columna].BackgroundImage = Properties.Resources.fototierra; matrizBotones[fila, columna].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; } else if (terreno.Get_Terreno() == "nieve") { matrizBotones[fila, columna].BackColor = Color.White; matrizBotones[fila, columna].BackgroundImage = Properties.Resources.fotonieve; matrizBotones[fila, columna].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; } else if (terreno.Get_Terreno() == "volcan") { matrizBotones[fila, columna].BackColor = Color.DarkRed; matrizBotones[fila, columna].BackgroundImage = Properties.Resources.fotolava; matrizBotones[fila, columna].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; } else { matrizBotones[fila, columna].BackColor = Color.Black; } // Bitmons en el mapa ponemos su foto (un biton por celda) if ((celda.bitmons_celda.Count > 0) && (celda.bitmons_celda.Count < 2)) { if (celda.bitmons_celda[0].Get_Especie() == "wetar") { // matrizBotones[fila, columna].BackgroundImage = foto_1; //matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].Text = "wetar"; matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].BackgroundImage = Properties.Resources.fotowetar; matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; } else if (celda.bitmons_celda[0].Get_Especie() == "dorvalo") { matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].BackgroundImage = Properties.Resources.fotodorvalo; matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; } else if (celda.bitmons_celda[0].Get_Especie() == "doti") { matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].BackgroundImage = Properties.Resources.fotodoti; matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; } else if (celda.bitmons_celda[0].Get_Especie() == "ent") { matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].BackgroundImage = Properties.Resources.fotoent; matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; } else if (celda.bitmons_celda[0].Get_Especie() == "gofue") { matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].BackgroundImage = Properties.Resources.fotogofue; matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; } else if (celda.bitmons_celda[0].Get_Especie() == "taplan") { matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].BackgroundImage = Properties.Resources.fototaplan; matrizBotones[celda.bitmons_celda[0].Get_Posx(), celda.bitmons_celda[0].Get_Posy()].BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; } else { nada += 0; } } // Cuando al inicio hay dos bitmons en una celda else if ((celda.bitmons_celda.Count > 1) && (celda.bitmons_celda.Count < 3)) { if ((celda.bitmons_celda[0].Get_Especie() == "wetar" && celda.bitmons_celda[1].Get_Especie() == "taplan") || (celda.bitmons_celda[0].Get_Especie() == "taplan" && celda.bitmons_celda[1].Get_Especie() == "wetar")) { mapa.CrearBitmon_Reproduccion(); } else if ((celda.bitmons_celda[0].Get_Especie() == "ent" && celda.bitmons_celda[1].Get_Especie() == "taplan") || (celda.bitmons_celda[0].Get_Especie() == "taplan" && celda.bitmons_celda[1].Get_Especie() == "ent")) { mapa.CrearBitmon_Reproduccion(); } else if ((celda.bitmons_celda[0].Get_Especie() == "doti" && celda.bitmons_celda[1].Get_Especie() == "taplan") || (celda.bitmons_celda[0].Get_Especie() == "taplan" && celda.bitmons_celda[1].Get_Especie() == "doti")) { mapa.CrearBitmon_Reproduccion(); } else if ((celda.bitmons_celda[0].Get_Especie() == "wetar" && celda.bitmons_celda[1].Get_Especie() == "doti") || (celda.bitmons_celda[0].Get_Especie() == "doti" && celda.bitmons_celda[1].Get_Especie() == "wetar")) { mapa.CrearBitmon_Reproduccion(); } else if ((celda.bitmons_celda[0].Get_Especie() == "doti" && celda.bitmons_celda[1].Get_Especie() == "ent") || (celda.bitmons_celda[0].Get_Especie() == "ent" && celda.bitmons_celda[1].Get_Especie() == "doti")) { mapa.CrearBitmon_Reproduccion(); } else if ((celda.bitmons_celda[0].Get_Especie() == "dorvalo" && celda.bitmons_celda[1].Get_Especie() == "gofue") || (celda.bitmons_celda[0].Get_Especie() == "gofue" && celda.bitmons_celda[1].Get_Especie() == "dorvalo")) { mapa.CrearBitmon_Reproduccion(); } else { mapa.mapa[fila, columna].bitmons_celda.RemoveAt(0); mapa.bithalla.Add(celda.bitmons_celda[0]); for (int i = 0; i < mapa.bitmons_mapa.Count; i++) { if (mapa.bitmons_mapa[i].Get_Especie() == celda.bitmons_celda[0].Get_Especie()) { mapa.bitmons_mapa.RemoveAt(i); } } } } } } }