예제 #1
0
    public void FrameUpdate()
    {
        _frame += 1;

        if (!_gameOver)
        {
            bool inputLock = true;

            if (_areDelay <= 0)
            {
                inputLock = false;

                if (_softDropEnabled)
                {
                    _gravityCount += _level.Gravity / 2;
                }
                else
                {
                    _gravityCount += 1;
                }

                if (_gravityCount >= _level.Gravity)
                {
                    GravityUpdate();
                    _gravityCount = 0;
                }
            }

            _input.Update(inputLock);


            if (_areDelay > 0)
            {
                _areDelay -= 1;
                if (_areDelay <= 0)
                {
                    //Next Level!
                    if (_rowsCleared >= _level.PassAmount)
                    {
                        _level.PassLevel();
                        _display.SetTileSet(_data.GetTileSet(_level.Level));
                    }
                    NewShape();
                }
            }
        }

        if (_boardDrity)
        {
            _display.UpdateDisplay(_board, _activeBricks);
            _boardDrity = false;
        }
    }
예제 #2
0
    public void UpdateDisplay(TileSet tileSet)
    {
        if (_display == null)
        {
            _display = this.GetComponent <BrickDisplay>();
            _display.Setup(tileSet);
        }

        if (_display != null && Shape != null)
        {
            _display.SetTileSet(tileSet);
            BoardModel board = new BoardModel(Shape.Size, Shape.Size);
            Shape.ApplyToBoard(board, 0);
            _display.UpdateDisplay(board);
        }
    }