Bacterium.Game.Start C# (CSharp) Method

Start() public method

public Start ( ) : void
return void
        public void Start()
        {
            MyPoint t;
            t = new MyPoint(_cells[0][0], MyPoint.LIGHT, 0, 0);
            this._grid.Children.Add(t.CurrentImage);
            _lightList.Add(t);
            t = new MyPoint(_cells[4][8], MyPoint.LIGHT, 4, 8);
            this._grid.Children.Add(t.CurrentImage);
            _lightList.Add(t);
            t = new MyPoint(_cells[8][4], MyPoint.LIGHT, 8, 4);
            this._grid.Children.Add(t.CurrentImage);
            _lightList.Add(t);
            t = new MyPoint(_cells[0][4], MyPoint.DARK, 0, 4);
            this._grid.Children.Add(t.CurrentImage);
            _darkList.Add(t);
            t = new MyPoint(_cells[4][0], MyPoint.DARK, 4, 0);
            this._grid.Children.Add(t.CurrentImage);
            _darkList.Add(t);
            t = new MyPoint(_cells[8][8], MyPoint.DARK, 8, 8);
            this._grid.Children.Add(t.CurrentImage);
            _darkList.Add(t);
            this.IsLightTurn = true;

            /*for (int i = 0; i < 9; i++)
                for (int j = 0; j < 9; j++)
                {
                    t = new MyPoint(_cells[i][j], MyPoint.LIGHT, i, j);
                    if (t.CurrentImage != null)
                        this._grid.Children.Add(t.CurrentImage);
                }*/
        }

Usage Example

Example #1
0
 private void StartGame()
 {
     //String path = Directory.GetCurrentDirectory() + @"\..\..\";
     String path = Directory.GetCurrentDirectory() + @"\";
     loadButton.Source = new BitmapImage(new Uri(path + @"Images\SaveAndLoad\Load1.png"));
     saveButton.Source = new BitmapImage(new Uri(path + @"Images\SaveAndLoad\Save1.png"));
     resetButton.Source = new BitmapImage(new Uri(path + @"Images\RestartArrows\RestartArrow1.png"));
     imageFlag1.Source = new BitmapImage(new Uri(path + @"Images\Flags\RedFlag.png"));
     imageFlag2.Source = new BitmapImage(new Uri(path + @"Images\Flags\GreenFlag.png"));
     BitmapImage tmp = new BitmapImage(new Uri(path + @"Images\Cells.png"));
     ImageBrush brush = new ImageBrush(tmp);
     RootGrid.Background = brush;
     _game = new Game(PointGrid);
     _game.Start();
     ShowState();
     this.Icon = new BitmapImage(new Uri(path + @"Images\icon.ico"));
     MessageBox.Show("The game is began!");
 }