public static void BajarPieza(Pieza piece) { for (int i = 0; i < 4; i++) { if (piece.Posiciones[i][0] == 0) { AgregarPosiciones(piece); return; } } for (int i = 0; i < Posiciones.Count; i++) { for (int j = 0; j < 4; j++) { if (Posiciones[i][0] == piece.Posiciones[j][0] - 1 && Posiciones[i][1] == piece.Posiciones[j][1]) { AgregarPosiciones(piece); return; } } } for (int i = 0; i < 4; i++) { piece.Posiciones[i][0]--; } BajarPieza(piece); }
public static void AgregarPosiciones(Pieza piece) { int i; for (i = 0; i < 4; i++) { Posiciones.Add(piece.Posiciones[i]); } }
public Pieza Rotar() { Pieza piece; if (this.Id == 0) { return(this); } else if (this.Id == 1) { piece = new Pieza(2); } else if (this.Id == 2) { piece = new Pieza(1); } else if ((3 <= this.Id) && (this.Id < 6)) { piece = new Pieza(this.Id + 1); } else if (this.Id == 6) { piece = new Pieza(3); } else if ((7 <= this.Id) && (this.Id < 10)) { piece = new Pieza(this.Id + 1); } else if (this.Id == 10) { piece = new Pieza(7); } else if (this.Id == 11) { piece = new Pieza(12); } else { piece = new Pieza(11); } return(piece); }
public static void Play(Pieza piece, int posHoriz) { piece.PiezaFueraDeTablero(Height, Width, posHoriz); BajarPieza(piece); }
public static Pieza NextPiece(int seed) { Pieza piece = new Pieza(seed); return(piece); }