Ejemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Create model
            Game game = new Game(NUMBER_OF_SHOTS,NUMBER_OF_ANIMALS);

            // Create view
            MainWindow gameWindow = new MainWindow(WIDTH, HEIGHT);
            GameView GameView = new GameView(game, WIDTH, HEIGHT); // view
            gameWindow.GameGrid.Children.Add(GameView);
            gameWindow.Show();

            // Add view to model
            game.AddView(GameView);

            // Create controller
            GameController gameController = new GameController(game);
            gameWindow.KeyDown += gameController.Move.GameView_KeyDown;

            // Add controller to view
            GameView.AddController(gameController);

            // Start game
            game.Start();
        }
Ejemplo n.º 2
0
 public BaseLevelState(Game game, int id, string bg)
 {
     this.game = game;
     ID = id;
     this.bg = bg;
     LevelFactory.Assign(this);
 }
Ejemplo n.º 3
0
        public GameView(Game game, int width, int height)
        {
            this.game = game;
            // Set background transparent for mouse event detection
            Color c = Colors.Black;
            c.A = 0;
            this.Background = new SolidColorBrush(c);
            DataContext = this;

            this.Height = height;
            this.Width = width;

            this.MouseLeftButtonDown += Shoot;
        }
Ejemplo n.º 4
0
 public LevelOne(Game game, string bg)
     : base(game, 1, bg)
 {
 }
Ejemplo n.º 5
0
 public LevelTwo(Game game, string bg)
     : base(game, 2, bg)
 {
 }
Ejemplo n.º 6
0
 public LevelFinished(Game game, string bg)
     : base(game, -1, bg)
 {
 }
Ejemplo n.º 7
0
 public GameController(Game game)
 {
     this.game = game;
     Move = new MoveController(game.Actions);
     game.Actions.AddMovesController(Move);
 }