Beispiel #1
0
        public PlayController() : base(ControllerNames.Play)
        {
            Rectangle[,] regions = new Rectangle[8, 8];

            gc = GameConfigs.GetInstance();

            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    regions[i, j] = new Rectangle(gc.GetRealPoint(j + 1, i + 1), new Point(gc.RegionWidth, gc.RegionHeight));
                }
            }

            gameMatrix = new GameMatrix(regions, 8, 8);

            gameModel = new GameModel(gameMatrix);

            gameMatrix.OnItemKilled += () =>
            {
                bonusPointsModel.Points += 1;
            };

            gameTimerModel        = new GameTimerModel();
            bonusPointsModel      = new BonusPointsModel();
            gameModel.Timer       = gameTimerModel;
            gameModel.BonusPoints = bonusPointsModel;

            renderer = new PlayRenderer(gameModel);

            gameTimerModel.Start();
        }
 public GameTimerModel()
 {
     gc       = GameConfigs.GetInstance();
     Region   = new Rectangle(gc.GetRealPoint(7.5f, 0.5f), new Point(0, 0));
     position = new Vector2(Region.X, Region.Y);
     State    = DynamicState.END;
 }
 public BonusPointsModel()
 {
     gc       = GameConfigs.GetInstance();
     Region   = new Rectangle(gc.GetRealPoint(1, 0.5f), new Point(0, 0));
     position = new Vector2(Region.X, Region.Y);
 }