示例#1
0
 public ScoreBoard(Board board, Rectangle bounds, Color backgroundColor)
 {
     _board = board;
     _bounds = bounds;
     _backgroundColor = backgroundColor;
     _texture = CreateTexture(TetrisGame.GetInstance().GraphicsDevice, bounds, backgroundColor);
     _font = TetrisGame.GetInstance().Content.Load<SpriteFont>("Fonts/ScoreBoard");
     _score = new Score();
     _score.LinesUpdated += TetrisGame.GetInstance().ChangeBackgroundColor;
 }
示例#2
0
 public void ChangeBackgroundColor(Score score, int updateValue)
 {
     // TODO: KG - Move to configuration.
     const int divider = 10;
     int oldValue = score.Lines - updateValue;
     int oldTenth = oldValue / divider;
     int newTenth = score.Lines / divider;
     if (newTenth > oldTenth)
     {
         BackgroundColor = new Color(StaticRandom.Next(256), StaticRandom.Next(256), StaticRandom.Next(256));
     }
 }