Ejemplo n.º 1
0
 public MainWindow(Game game, int canvasHeight, int canvasWidth)
 {
     this.DataContext = new MainWindowViewModel(game, canvasHeight, canvasWidth);
     InitializeComponent();
     ((MainWindowViewModel)this.DataContext).ColorLandGame.Board.DrawBoard(GameCanvas);
     ((MainWindowViewModel)this.DataContext).ColorLandGame.Start(this);
     ((MainWindowViewModel)this.DataContext).ColorLandGame.DrawPlayers();
 }
Ejemplo n.º 2
0
 public MainWindowViewModel(Game game, int canvasHeight, int canvasWidth)
 {
     _game = game;
     CanvasHeight = canvasHeight;
     CanvasWidth = canvasWidth;
 }
Ejemplo n.º 3
0
        public void StartGame(MenuWindow window)
        {
            if(!IsRandomSeed)
                Randomizer.SetSeed(Seed);

            Game game = new Game(new Board(BoardHeight, BoardWidth, (BoardHeight * 20), (BoardWidth * 20)));

            for (int i = 0; i < Players.Count; i++)
            {
                if (Players[i].Name == null)
                    Players[i].Name = GetRandomName(Players[i].IsBot);

                if (Players[i].IsBot)
                    game.AddBot(Players[i].Name);
                else
                    game.AddHuman(Players[i].Name);
            }

            MainWindow mainWindow = new MainWindow(game, (BoardHeight * 20), (BoardWidth * 20));
            mainWindow.Show();
            window.Close();
        }