Example #1
0
 public void NewGame(GameBoardMode _mode)
 {
     /*New game stuff goes here*/
     //GameBoard Initalization
     //First we will check to see if the board config we were given is different than the one we have
     if (!_mode.boardConfig.Equals(boardConfig))
     {
         //If it is different, then let's create a new board
         boardConfig = _mode.boardConfig;
         board       = new int[boardConfig.gridWidth, boardConfig.gridHeight];
         scale       = 1.0f;
         CalibrateRects(_mode.boardConfig);
     }
     else
     {
         //If they are the same, then nothing needs to be recreated. Let's just wipe the board clean
         WipeBoard();
     }
     highscore   = _mode.highScore;
     score       = 0;
     isGameOver  = false;
     reached2048 = reached3072 = false;
     isMoved     = false;
     //Run the RunOnce event if it's set
     if (initEvent != null)
     {
         initEvent();
     }
     //SPAWNING FIRST BLOCK
     SpawnNewBlock();
     SpawnNewBlock();
     if (boardConfig.gameMode == GameModeState.Threes)
     {
         SpawnNewBlock();
     }
 }
Example #2
0
 public void NewGame(GameBoardMode _mode)
 {
     /*New game stuff goes here*/
     //GameBoard Initalization
     //First we will check to see if the board config we were given is different than the one we have
     if (!_mode.boardConfig.Equals(boardConfig)) {
         //If it is different, then let's create a new board
         boardConfig = _mode.boardConfig;
         board = new int[boardConfig.gridWidth, boardConfig.gridHeight];
         scale = 1.0f;
         CalibrateRects(_mode.boardConfig);
     } else {
         //If they are the same, then nothing needs to be recreated. Let's just wipe the board clean
         WipeBoard();
     }
     highscore = _mode.highScore;
     score = 0;
     isGameOver = false;
     reached2048 = reached3072 = false;
     isMoved = false;
     //Run the RunOnce event if it's set
     if (initEvent != null) {
         initEvent();
     }
     //SPAWNING FIRST BLOCK
     SpawnNewBlock();
     SpawnNewBlock();
     if (boardConfig.gameMode == GameModeState.Threes) {
         SpawnNewBlock();
     }
 }