public void BasicTestInitBoardFromFirstPlayer() { ServerBoard sb = new ServerBoard(); Ownership player = Ownership.FirstPlayer; ICell[] default_pieces = Board.GetDefaultPieces(player).ToArray(); string[] user_pieces_id_strings = default_pieces.Select(cell => cell.ToString()).ToArray(); Assert.True(sb.InitBoardFromUser(user_pieces_id_strings, player)); Position pos = new Position(0, 0); int index = pos.to_board_index(); int end_index = new Position(Board.DefaultBoardSize - 1, 1).to_board_index(); for (; index <= end_index; index++) { pos = Position.PositionFromIndex(index); ICell expected = default_pieces[index]; ICell from_board = sb.SampleLocation(pos, player); Assert.Zero(from_board.ToString().CompareTo(expected.ToString())); } }
void Awake() { if( instance == null ) { instance = this; }else{ Destroy(this); } Messenger.AddListener("action done", OnActionDone); Messenger.AddListener("game over", OnGameOver); boardManager = new BoardManager (100, instance, dungeonPrefab, item_list); myBackEnd = GetComponent<ServerBoard>(); enemies = new GameObject[3]; currentLevel = 0; enemyTurn = new EnemyTurnState(this); playerTurn = new PlayerTurnState(this); GameOverTurn = new GameOverState(this); menuTurn = new PopMenuState(this); inti_ready = false; DontDestroyOnLoad(this); }