예제 #1
0
    public virtual void PlayChess()
    {
        if (chessManager.CanPlay && Input.GetMouseButtonDown(0)&&!EventSystem.current.IsPointerOverGameObject())
        {

            var p = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            Vector2Int pointPos;
            if (chessBoardManager.InputAxisToPoint(p, out pointPos))
            {
                Vector2 chessPos;
                if (chessBoardManager.PointCanPlayChess(pointPos) && chessBoardManager.GetAxisByPoint(pointPos, out chessPos))
                {
                    var go = chessManager.DoPlayChess(chessPos);
                    if(chessBoardManager.PlayChess(pointPos, ChessType, go))
                    {
                        mainGameManager.WinGame();
                    }
                    else
                    {
                        mainGameManager.SwitchNowPlayer();
                    }
                }
            }
        }
    }