Ejemplo n.º 1
0
 public Game(IScene scene, IRandomFigureSelector randomFigureSelector)
 {
     scene.Cup = new TetrisCup(10, 20, new Point[] { });
     scene.NextFigure(randomFigureSelector.RandomFigure());
     this.NextFigure = randomFigureSelector.RandomFigure();
     Scene = scene;
     Level = 1;
     SpeedInSeconds = 0.5;
     _randomFigureSelector = randomFigureSelector;
 }
Ejemplo n.º 2
0
 public Game(IScene scene, IRandomFigureSelector randomFigureSelector)
 {
     scene.Cup = new TetrisCup(10, 20, new Point[] { });
     scene.NextFigure(randomFigureSelector.RandomFigure());
     this.NextFigure       = randomFigureSelector.RandomFigure();
     Scene                 = scene;
     Level                 = 1;
     SpeedInSeconds        = 0.5;
     _randomFigureSelector = randomFigureSelector;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// occures every time timer ticks
        /// 1. moves figure down
        /// 2. if it isn't possible - prints it
        /// 3. if when prints, chooses the next one
        /// 4. if when it's the first tick - starts the game by choosen the next figure
        /// </summary>
        public void Tick()
        {
            var isPossible = Scene.MoveDown();

            if (!isPossible)
            {
                Scene.Print();
                Score++;
                Scene.NextFigure(NextFigure);
                this.NextFigure = _randomFigureSelector.RandomFigure();
                //Scene.NextFigure(_randomFigureSelector.RandomFigure());
                int counter = Scene.EraseFullLines();
                Score += counter * 10;
                SetLevel();
            }
        }