Esempio n. 1
0
    public void placeChessUnsafeAI(int xx, int yy, int dir, int ownner)
    {
        GridObj  go  = findGridObj(xx, yy);
        ChessObj co  = generateChess(go.x, go.y, go, ownner);
        int      idm = _Manager.makeNewChessUnSafe(xx, yy, dir, ownner);

        co._ChessIdentityNumber = idm;
        _ChessList.Add(co);
        go._Chess = co;
        co.rotate(dir);
        GameManager._Main.updateChessBoard();
        updateBoard();
        Debug.Log("生成了一颗棋子");
    }
Esempio n. 2
0
    public void makeChess(int xx, int yy, int dir, int oo)
    {
        GridObj  go  = findGridObj(xx, yy);
        ChessObj co  = generateChess(go.x, go.y, go, oo);
        int      idm = _Manager.makeNewChessUnSafe(xx, yy, dir, oo);

        co._ChessIdentityNumber = idm;
        _ChessList.Add(co);
        go._Chess = co;
        co.rotate(dir);

        Debug.Log("生成了一颗棋子");

        return;
    }
Esempio n. 3
0
    public void changeDgree(float dg)
    {
        if (!_Manager.ifThisPlayerLocal())
        {
            return;
        }

        if (!_IsStarted)
        {
            return;
        }

        if (_TempChess == null)
        {
            return;
        }
        _ChessLog2Transform.DOMove(_ChessLogStart.position, 0.5f);
        _ChessLog3Transform.DOMove(_ChessLogStart.position, 0.5f);


        int i = (int)(Mathf.Rad2Deg * dg);

        i = (i + 480) % 360;
        i = i / 60;

        if (i == _TempChess._Direction)
        {
            return;
        }

        _TempChess.rotate(i);

        List <int> oks = _Manager.getUsableDirection();

        //如果这个方向不禁手
        if (oks.Contains(i))
        {
            LiuheChessBoard lcb = _Manager.tryToPlace(_TempChess.x, _TempChess.y, _TempChess._Direction);


            if (lcb == null)
            {
                Debug.Log("严重错误,不能增加棋子的格子增加棋子了!");
                return;
            }

            //更新棋子显示
            updateBoard(lcb.chesses);

            LiuheChess lc = lcb.findChessByPosition(_TempChess.x, _TempChess.y);
            if (lc == null)
            {
                Debug.Log("严重错误,不能增加棋子的格子增加棋子了!");
                return;
            }

            if (lc.health <= 0)
            {
                _WarningText.text = _Warning_Info[0];
                _ChessLogTransform.DOMove(_ChessLogEnd.position, 0.5f);
            }
            else
            {
                _ChessLogTransform.DOMove(_ChessLogStart.position, 0.5f);
            }
            //Debug.Log("可以下哦");
        }
        //如果这个方向禁手
        else
        {
            _WarningText.text = _Warning_Info[1];
            _ChessLogTransform.DOMove(_ChessLogEnd.position, 0.5f);
            _TempChess.setVoid();
            updateBoard();
            //Debug.Log("不可以下哦");
        }
    }