Esempio n. 1
0
    void ShowText(ChessControl chess)
    {
        int    hp       = chess.GetHp();
        Team   team     = chess.GetTeam();
        string teamWord = team == Team.RedTeam ? "红队" : "蓝队";

        teamText.text  = "队伍:" + teamWord;
        heroName.text  = $"英雄:{chess.HeroInfo.name}";
        hpText.text    = "血量:" + hp.ToString();
        atkText.text   = $"攻击:{chess.HeroInfo.atk}";
        skillText.text = $"技能名称:{chess.HeroInfo.skillName}\n技能描述:{chess.HeroInfo.skillText}";

        showText.SetActive(true);
    }
Esempio n. 2
0
    public bool MovingChess(GridControl grid)
    {
        // 移动棋子
        activeGrid.CancelTouch(saveGrid);

        ChessControl chessItem = activeGrid.ContentChess;

        chessItem.transform.position = grid.transform.position;

        activeGrid.ContentChess = null;
        grid.ContentChess       = chessItem;

        // 寻找途中有无棋子 有且不同队可以扣血
        Direction   direction = saveGrid[grid];
        GridControl gridTmp   = activeGrid.neighbors[(int)direction];
        bool        jumped    = false;

        while (gridTmp != grid)
        {
            jumped = true;
            if (gridTmp.CheckChess())
            {
                if (!gridTmp.ContentChess.CompareTeam(chessItem.GetTeam()))
                {
                    gridTmp.ContentChess.ReduceHP();
                }
            }
            gridTmp = gridTmp.neighbors[(int)direction];
        }

        if (jumped)
        {
            saveGrid = grid.RepeatedJump(activeGrid);
        }

        activeGrid = grid;

        return(jumped);
    }