public PlayerController(InputKeys inputKeys, Action <int, int, int> gameOverAction) { _inputKeys = inputKeys; GameModel = new TetrisModel(PlayerPrefs.GetInt("BoardWidth"), PlayerPrefs.GetInt("BoardHeight")); GameController = new Controller.Controller(GameModel); GameView = new TetrisView(GameModel, GameController); GameModel.GameOver += (sender, args) => gameOverAction(args.CollectedLinesCount, args.Score, args.Level); }
public TetrisView(TetrisModel model, Controller.Controller controller) { _model = model; _controller = controller; _model.MovementDone += OnMovementDone; _model.RotateDone += OnRotateDone; _model.ShapeAdded += OnShapeAdded; _model.LinesDestroyed += OnLinesDestroyed; _model.GameOver += OnGameOver; _model.ShapeDropping += OnShapeDropping; _model.ShapeIsAttachedAddListener(OnShapeIsAttached); _model.BlockIsAttachedAddListener(OnAttachedBlock); }
public Controller(TetrisModel model) { _model = model; }