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); }
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; }
public LevelOne(Game game, string bg) : base(game, 1, bg) { }
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); }