Exemple #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();
        }
 public BaseLevelState(Game game, int id, string bg)
 {
     this.game = game;
     ID = id;
     this.bg = bg;
     LevelFactory.Assign(this);
 }
Exemple #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;
        }
Exemple #4
0
 public LevelOne(Game game, string bg)
     : base(game, 1, bg)
 {
 }
Exemple #5
0
 public LevelTwo(Game game, string bg)
     : base(game, 2, bg)
 {
 }
 public LevelFinished(Game game, string bg)
     : base(game, -1, bg)
 {
 }
 public GameController(Game game)
 {
     this.game = game;
     Move = new MoveController(game.Actions);
     game.Actions.AddMovesController(Move);
 }