public void DrawAll(TetrisGameState state, ScoreManager scoreManager) { this.DrawBorder(); this.DrawGameState(3 + this.tetrisColumns, state, scoreManager); this.DrawTetrisField(state.TetrisField); this.DrawCurrentFigure(state.CurrentFigure, state.CurrentFigureRow, state.CurrentFigureCol); }
public void DrawAll(TetrisGameState gameState) { this.DrawBorder(tetrisRows, tetrisCols, tetrisInfo); this.DrawGameState(3 + tetrisCols, gameState); this.DrawTetrisField(gameState.TetrisField); this.DrawCurrentFigure(gameState.CurrentFigure, gameState.CurrentFigureRow, gameState.CurrentFigureCol); }
public void DrawGameState(int startCol, TetrisGameState gameState)//3 + tetrisCols { this.Write("Score: ", 1, startCol); this.Write($"{gameState.Score}", 2, startCol); this.Write("Frame: ", 4, startCol); this.Write($"{gameState.Frame}", 5, startCol); this.Write("Keys: ", 7, startCol); this.Write(" ^ ", 9, startCol); this.Write("< >", 10, startCol); this.Write(" v ", 11, startCol); }
public void Run() { gameState = new TetrisGameState(tetrisRows, tetrisCols); Random random = new Random(); var tetrisConsoleWriter = new TetrisConsoleWriter(tetrisRows, tetrisCols, tetrisInfo); Console.ForegroundColor = ConsoleColor.DarkYellow; Console.Title = "Tetris v1.0"; Console.CursorVisible = false; gameState.CurrentFigure = tetrisFigures[random.Next(0, tetrisFigures.Count)]; KeyAvailable(tetrisConsoleWriter, random); }
public void DrawGameState(int startColumn, TetrisGameState state, ScoreManager scoreManager) { this.Write("Level:", 1, startColumn); this.Write(state.Level.ToString(), 2, startColumn); this.Write("Score:", 4, startColumn); this.Write(scoreManager.Score.ToString(), 5, startColumn); this.Write("Best:", 7, startColumn); this.Write(scoreManager.HighScore.ToString(), 8, startColumn); this.Write("Frame:", 10, startColumn); this.Write(state.Frame.ToString() + " / " + (state.FramesToMoveFigure - state.Level).ToString(), 11, startColumn); this.Write("Position:", 13, startColumn); this.Write($"{state.CurrentFigureRow}, {state.CurrentFigureCol}", 14, startColumn); this.Write("Keys:", 16, startColumn); this.Write($" ^ ", 18, startColumn); this.Write($"< > ", 19, startColumn); this.Write($" v ", 20, startColumn); }