Exemplo n.º 1
0
    /// <summary>
    /// 自分のターンを開始する
    /// </summary>
    private void StartTurn()
    {
        /* 自分のコマをアクティブにする */
        List <BoardIndex> indexList = board.GetMyTopBoardIndex();

        foreach (BoardIndex index in indexList)
        {
            GameObject obj = board.GetObjByIndex(index);
            obj.GetComponent <BattleTopCtrl>().SetIsMyTurn(true);
        }

        //自分の持ち駒をすべてアクティブにする
        List <GameObject> objList = myTopStage.GetGameObjectAll();

        foreach (GameObject obj in objList)
        {
            obj.GetComponent <BattleTopCtrl>().SetIsMyTurn(true);
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 盤面アップデート
    /// </summary>
    /// <param name="inf"></param>
    private void BoardUpDate(TopMoveInf inf)
    {
        BoardIndex source;

        //持ち駒かどうかによってソースは変わる
        if (inf.IsBring)
        {
            source = ComvOppenentIndexChild(inf.source);
        }
        else
        {
            source = ComvOpponentIndex(inf.source);
        }
        BoardIndex distination = ComvOpponentIndex(inf.destination);


        //行先にコマがあれば削除して相手の持ち駒とする
        if (board.ChkBoardTop(distination))
        {
            GameObject obj = board.GetObjByIndex(distination);
            board.DelBoardInf(distination);

            int id = obj.GetComponent <BattleTopCtrl>().topId;
            LostATop(obj);
        }

        //盤面情報更新
        if (inf.IsBring)
        {
            GameObject obj = opponentTopStage.GetObjByIndex(source);
            //相手からの情報なので相手の持ち駒を削除
            opponentTopStage.DelBoardInf(source);

            int     topId  = obj.GetComponent <BattleTopCtrl>().topId;
            Vector2 tmpVec = board.GetBoardPosByIndex(distination);
            obj.transform.position = new Vector3(tmpVec.x, 1, tmpVec.y);
            board.SetBoardInf(topId, obj, false, distination);
            PaintCell(new BoardIndex(distination.xIndex, distination.yIndex), false);
        }
        else
        {
            GameObject obj = board.GetObjByIndex(source);

            board.DelBoardInf(source);

            int     topId  = obj.GetComponent <BattleTopCtrl>().topId;
            Vector2 tmpVec = board.GetBoardPosByIndex(distination);
            obj.transform.position = new Vector3(tmpVec.x, 1, tmpVec.y);
            board.SetBoardInf(topId, obj, false, distination);

            //とびがないかチェック(狙撃手はとび確認不要)
            if (topId != 9)
            {
                List <BoardIndex> indexList =
                    board.GetCellIndexBitweenCells(source, distination);

                foreach (BoardIndex index in indexList)
                {
                    PaintCell(index, false);
                }
            }
            PaintCell(new BoardIndex(distination.xIndex, distination.yIndex), false);
        }
    }