Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public Controller(TetrisModel model)
 {
     _model = model;
 }