Beispiel #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (SapperGame game = new SapperGame())
     {
         game.Run();
     }
 }
Beispiel #2
0
 protected Cell(SapperGame sapperGame, Texture2D cellBackGroundTexture, Rectangle position, int boardPositionX, int boardPositionY)
 {
     SapperGame            = sapperGame;
     CellBackgroundTexture = cellBackGroundTexture;
     PositionRectangle     = position;
     BoardPositionX        = boardPositionX;
     BoardPositionY        = boardPositionY;
 }
Beispiel #3
0
 public override void OnClick()
 {
     if (IsFlagOn)
     {
         return;
     }
     SapperGame.LoseGame();
     _isExploded = true;
 }
Beispiel #4
0
        public Board(SapperGame sapperGame, int minesNum, int lenght)
        {
            _sapperGame = sapperGame;
            BoardMatrix = new Cell[lenght, lenght];
            _minesList  = new List <MineCell>();
            Rectangle position = new Rectangle(100, 200, 40, 40);

            for (int i = 0; i < lenght; i++)
            {
                for (int j = 0; j < lenght; j++)
                {
                    BoardMatrix[i, j] = new EmptyCell(_sapperGame, _sapperGame.GameTextures["cleanTexture"],
                                                      _sapperGame.GameFonts["defaultFont"], position, i, j);
                    position.X += position.Width + 1;
                }
                position.X  = 100;
                position.Y += position.Height + 1;
            }

            NumOfFlags = minesNum;
        }
Beispiel #5
0
 public MineCell(SapperGame game, Texture2D cellBackGroundTexture, Texture2D mineTexture, Rectangle position, int boardPositionX, int boardPositionY) : base(game, cellBackGroundTexture, position, boardPositionX, boardPositionY)
 {
     _mineTexture = mineTexture;
 }
Beispiel #6
0
 public EmptyCell(SapperGame game, Texture2D cellBackGroundTexture, SpriteFont textFont, Rectangle position, int boardPositionX, int boardPositionY) : base(game, cellBackGroundTexture, position, boardPositionX, boardPositionY)
 {
     _textFont = textFont;
 }