Exemplo n.º 1
0
    public IEnumerator Fall(Action <bool> onFall)
    {
        if (!_model.Falling)
        {
            _model.Falling = true;
            yield return(new WaitForSeconds(1 / _model.Speed));

            var moved = _model.Move(new Cell(1, 0));
            _view.PlaceBlocks(_model.GetCurrentBlocks());

            onFall(!moved);

            _model.Falling = false;
        }
    }
Exemplo n.º 2
0
    private Shape SpawnShape(float shapeSpeed)
    {
        var shp = ShapeFactory.CreateRandom();

        shp.Pos              = new Cell(0, 5);
        shp.Speed            = shapeSpeed;
        shp.MovementRestrict = board.IsEmptyCell;
        shapeView.PlaceBlocks(shp.GetCurrentBlocks());

        shapeController = new ShapeController(shp, shapeView);

        return(shp);
    }
Exemplo n.º 3
0
    private Shape SpawnShape(float shapeSpeed)
    {
        Shape shape;

        if (_gameSettings.ShapeType == ShapeType.Random)
        {
            shape = ShapeFactory.CreateRandom();
        }
        else
        {
            shape = ShapeFactory.CreateShape(_gameSettings.ShapeType);
        }

        shape.Pos              = new Cell(0, 5);
        shape.Speed            = shapeSpeed;
        shape.MovementRestrict = _board.IsEmptyCell;
        _shapeView.PlaceBlocks(shape.GetCurrentBlocks());

        _shapeController = new ShapeController(shape, _shapeView);

        return(shape);
    }