コード例 #1
0
    //走棋
    virtual public void moveChess(Chess moving_chess, ChessContainer targetContainer, bool trigger_strike)
    {
        /*  移动耗牌
         * if (Data.MOVE_COST_HANDCARD)
         * {
         * CardContainer cdc;
         * GameObject[] cdcs;
         * ArrayList hand;
         * if (turn_player == ePlayer.Player1)
         * {
         * cdc = cardcont_p1[0].GetComponent<CardContainer>();
         * cdcs = cardcont_p1;
         * hand = player_1.hand_cards;
         * } else
         * {
         * cdc = cardcont_p2[0].GetComponent<CardContainer>();
         * cdcs = cardcont_p2;
         * hand = player_2.hand_cards;
         * }
         * if (cdc.gameObject.transform.childCount <= 0)
         * {
         * return;
         * }
         * Card card = cdc.gameObject.transform.GetChild(0).gameObject.GetComponent<Card>();
         * if (!judgeSelectCard(card))
         * return;
         * removeCard(card);
         * setHand(hand, cdcs);
         * }*/

        moving_chess.container.removeChess();
        targetContainer.appendChess(moving_chess);

        //驱散迷雾 随设计改变而无效
        //BKTools.FogLift(moving_chess.container.number, moving_chess.attribute.spd + GameRule.Default_PvE_Fog_Lift_Range, GameRule.Default_PvE_Fog_Lift_Range, new int[] { (int)moving_chess.belong });
        //攻击
        if (trigger_strike && !BuffContrllor.ContainEffect(moving_chess, eBuff_Effect.Attack_BAN))
        {
            moving_chess.CheckStrike(0);
        }
        //卡牌信息显示
        Main.Inst.clearCardInfo();
        //TODO 流程控制更新
        //		Main.Instance.b_setchess = true;
        //		Main.Instance.now_phase = ePhase.Battle;
        //		Main.Instance.b_phase_trigger = true;//从战斗阶段往主要阶段2

        //清除移动操作暴击
        Main.Inst.b_moving_chess = false;        //应该已经没用了
        Chess.clear_Moveable_Area();
        //清理所有移动标记(上面谁写的,都是错别字!
        foreach (var item in Main.Inst.chess_grids)
        {
            item.Value.clearMoveFlag();
        }

        CheckMoveEvent(moving_chess, nextPhaseDefault);
    }
コード例 #2
0
    //占用特定位置时,被执行踢开
    public void KickAway()
    {
        ChessContainer toGrid = null;

        for (int i = 0; i < 10; i++)
        {
            foreach (var getGrid in Main.Inst.dGetChessContainer)
            {
                toGrid = getGrid(container);
                //TODO 有可能提到活动区域外,再说
                if (toGrid != null && toGrid.my_chess == null)
                {
                    break;
                }
            }
            //			if(container.CCUpperLeft.my_chess == null)
        }

        if (toGrid != null && toGrid.my_chess == null)
        {
            container.removeChess();
            toGrid.appendChess(this);
        }
    }
コード例 #3
0
    //下棋
    virtual public Chess setChess(int card_id, ePlayer card_belong, ChessContainer t_grid, BKKZ.POW01.AI.eAI_Type ai_type, bool trigger_shokan_skill, int shoukan_event, int event_sequence)
    {
        //TODO 后期加入召唤参数,如果是强制召唤才能把当前格子上的骑士顶开
        if (t_grid.my_chess != null)
        {
            t_grid.my_chess.KickAway();
        }

        //分支 pve玩家召唤时有可能是第二次召唤
        bool need_new = true;
        long chessid  = 0;

        if (Main.Inst.lv_ctrl.map_data.my_type == eMapType.PvE_Mult || Main.Inst.lv_ctrl.map_data.my_type == eMapType.PvE_Solo)
        {
            chessid  = Chess.genarateChessID(card_id, (int)card_belong, shoukan_event, event_sequence);
            need_new = !Main.Inst.dic_chess.ContainsKey(chessid);
        }
        Chess the_chess = null;

        if (need_new)
        {
            //创建棋子
            the_chess = Instantiate(BKTools.LoadAsset <GameObject>(eResBundle.Prefabs, PrefabPath.Chess)).GetComponent <Chess>();
            the_chess.attribute.card_id = card_id;
            the_chess.belong            = card_belong;
            the_chess.owner             = card_belong;
            the_chess.MouseDown         = Main.Inst.MouseDownOnChess;
            the_chess.MouseUp           = Main.Inst.MouseUpOnChess;
            //召唤信息——对应事件——玩家为-1
            the_chess.shoukan_event = shoukan_event;
            //事件ID确认后可以获得事件序号
            the_chess.shoukan_event_sequence = event_sequence;
            //初始化数据
            the_chess.initData();
            //初始化图片
            the_chess.initImage();

            Main.Inst.dic_chess.Add(the_chess.ChessID, the_chess);

            //创建AI
            if (card_belong < ePlayer.Player1 || card_belong > ePlayer.Player4)
            {
                BKKZ.POW01.AI.MonsterAI.createMonsterAI(the_chess.ChessID, ai_type);
            }
        }
        else
        {
            the_chess = Main.Inst.dic_chess[chessid];
            the_chess.gameObject.SetActive(true);
        }
        t_grid.appendChess(the_chess);
        //召唤技能
        if (trigger_shokan_skill)
        {
            the_chess.ShouKanSkillAndPincer();
        }

        //驱散迷雾
        //BKTools.FogLift(newchess.container.number, newchess.attribute.spd + GameRule.Default_PvE_Fog_Lift_Range, GameRule.Default_PvE_Fog_Lift_Range, new int[] { (int)newchess.belong });

        //		Main.Instance.b_setchess = true;
        //		Main.Instance.now_phase = ePhase.Battle;
        //		Main.Instance.b_phase_trigger = true;//从战斗阶段往主要阶段2

        // 只有主流会耗卡
        if (Main.Inst.now_turnphase.myType == ePhaseType.Main1)
        {
            UseHandCard();
        }

        if (Main.Inst.now_turnphase.myType != ePhaseType.Drama)
        {
            CheckMoveEvent(the_chess, nextPhaseDefault);
        }
        return(the_chess);
    }