public void InitialisePredictionBox(GameForm creator) { m_NewTetronimo = m_NextTetronimo.GetNextTetronimo(); GameController_NewTetronimoCreated.Invoke(this, new NewTetronimoEventArgs(m_NewTetronimo)); GameController_NewTetronimoCreated -= creator.SetUpPredictionBox; GameController_NewTetronimoCreated += creator.SyncUpPredictionBox; }
internal void CreateNewTetronimo(object sender, EventArgs e) { m_OldTetronimo = m_NewTetronimo; m_NewTetronimo = m_NextTetronimo.GetNextTetronimo(); GameController_NewTetronimoCreated.Invoke(this, new NewTetronimoEventArgs(m_NewTetronimo)); m_GameGrid.DisplayNewTetronimo(m_OldTetronimo); }
public List <PictureBox> ConvertToPictureBox(Tetronimo tetronimo) { List <PictureBox> result = new List <PictureBox>(4); for (int i = 0; i < 4; i++) { var newPictureBox = new PictureBox(); newPictureBox.Size = new System.Drawing.Size(20, 20); newPictureBox.Location = tetronimo.Form[i]; newPictureBox.Image = SelectBlockImage(tetronimo.Color); newPictureBox.BackColor = Color.Black; result.Add(newPictureBox); } return(result); }
public void DisplayNewTetronimo(Tetronimo newBlock) { m_IsTetronimoGrounded = false; m_TetronimoType = newBlock.TetronimoType; m_RotationState = TetronimoRotationState.Eins; m_Tetronimo = new List <GameTile>(4); var idList = m_TConverter.ConvertToGameGrid(newBlock); foreach (var item in idList) { var gameTile = FindGameTileByID(item); gameTile.Color = newBlock.Color; gameTile.IsTetronimo = true; m_Tetronimo.Add(gameTile); } }
public Tetronimo GetNextTetronimo() { Tetronimo returnValue; switch (m_Random.Next(1, 8)) { case 1: returnValue = new Tetronimo(TetronimoType.I); break; case 2: returnValue = new Tetronimo(TetronimoType.J); break; case 3: returnValue = new Tetronimo(TetronimoType.L); break; case 4: returnValue = new Tetronimo(TetronimoType.O); break; case 5: returnValue = new Tetronimo(TetronimoType.S); break; case 6: returnValue = new Tetronimo(TetronimoType.T); break; case 7: returnValue = new Tetronimo(TetronimoType.Z); break; default: returnValue = new Tetronimo(TetronimoType.Unknown); break; } return(returnValue); }
internal NewTetronimoEventArgs(Tetronimo newTetronimo) { NewTetronimo = newTetronimo; }
//Zweiter Converter für neuen Tetronimo im Grid public List <int> ConvertToGameGrid(Tetronimo tetronimo) { List <int> resultList = new List <int>(4); switch (tetronimo.TetronimoType) { case TetronimoType.I: resultList.Add(3105); resultList.Add(3205); resultList.Add(3305); resultList.Add(3405); break; case TetronimoType.J: resultList.Add(3105); resultList.Add(3205); resultList.Add(3305); resultList.Add(3304); break; case TetronimoType.L: resultList.Add(3105); resultList.Add(3205); resultList.Add(3305); resultList.Add(3306); break; case TetronimoType.O: resultList.Add(3105); resultList.Add(3106); resultList.Add(3205); resultList.Add(3206); break; case TetronimoType.S: resultList.Add(3105); resultList.Add(3106); resultList.Add(3204); resultList.Add(3205); break; case TetronimoType.T: resultList.Add(3104); resultList.Add(3105); resultList.Add(3106); resultList.Add(3205); break; case TetronimoType.Z: resultList.Add(3104); resultList.Add(3105); resultList.Add(3205); resultList.Add(3206); break; case TetronimoType.Unknown: break; default: break; } return(resultList); }