Beispiel #1
0
    private Mode gameMode;                    // the game mode of the board (what and where pieces should be in the board)

    public ChessBoard(int x, int y, Mode mode, Dictionary <string, bool> options)
    {
        chessTiles  = new ChessTile[x, y];
        blackPieces = new List <ChessPiece>();
        whitePieces = new List <ChessPiece>();

        eatenByBlack = new List <ChessPiece>();
        eatenByWhite = new List <ChessPiece>();

        if (options.Count == 0)
        {
            _SetDefaultOptions();
        }
        else
        {
            Options = options;
        }

        this.uiPromotion = GameObject.Find("Promotion_Canvas").GetComponent <UIPromotionManager>();
        this.uiWin       = GameObject.Find("Win_Canvas").GetComponent <UIWinManager>();

        gameMode = mode;

        _Create(0, 0); // Create the board's unity game object

        _Generate();   // Generate the tiles and pieces

        Sprite blackTile = GameManager.SpriteManager["blackTile"];
        float  x_pixels  = blackTile.rect.width / blackTile.pixelsPerUnit;
        float  y_pixels  = blackTile.rect.height / blackTile.pixelsPerUnit;

        Camera.main.transform.position = new Vector3(((chessTiles.GetLength(0) / 2) - 1) * x_pixels + (x_pixels / 2), ((chessTiles.GetLength(1) / 2) - 1) * y_pixels + (y_pixels / 2), -10);
        Camera.main.orthographicSize   = 13; // +3 = +2 tiles in Y-axis (above and below) //Ray: make it 13 from 12
    }
Beispiel #2
0
    public void WinGameOver()
    {
        UIWinManager _ui = GetComponent <UIWinManager>();

        if (_ui != null)
        {
            _ui.ToggleWinPanel();
        }
    }