コード例 #1
0
    public void show_movable_area()
    {
        List <ChessContainer> result_list = new List <ChessContainer>();

        //TODO 等BK_Tools中getAroundGrid函数重写后替换
        //container.search_around(ref result_list, 0, attribute.spd);
        result_list.Add(container);
        BKTools.getAroundGrid(attribute.Spd, result_list, true, false, null);
        result_list.Remove(container);

        #region 清理不在战斗区域的标记
        List <ChessContainer> not_in_battle_area = new List <ChessContainer>();
        foreach (var item in result_list)
        {
            if (!Main.Inst.lv_ctrl.AreaBattle.Contains(item.number))
            {
                not_in_battle_area.Add(item);
            }
        }
        foreach (var grid in not_in_battle_area)
        {
            result_list.Remove(grid);
        }
        #endregion

        foreach (ChessContainer cc in result_list)
        {
            if (cc.isMoveBan(owner))
            {
                continue;
            }
            //可移动区域-面片色块
            GameObject obj = Instantiate(bg_move, cc.transform.position, cc.transform.rotation);
            list_movable_area.Add(obj);
            cc.setMoveFlag_On();
            obj.transform.parent = transform;
            Vector3 new_pos = obj.transform.localPosition;
            new_pos.z = 0.3f;
            obj.transform.localPosition = new_pos;
        }
    }
コード例 #2
0
        public List <Operation> generateOperations()
        {
            Chess c = my_chess;
            List <ChessContainer> res_list    = new List <ChessContainer> ();
            List <ChessContainer> search_list = new List <ChessContainer> ();

            search_list.Add(c.container);
            search_list = BKTools.getAroundGrid(c.attribute.Spd, search_list);
            res_list.Add(c.container);//原地不动也是一种选择
            foreach (var item in search_list)
            {
                //TODO 判断条件需要完善
                if (item.my_chess == null && GameRule.judgePassable(c, item))
                {
                    res_list.Add(item);
                }
            }

            //return res_list;
            List <Operation> op_list = new List <Operation>();

            //检索所有移动选项
            foreach (var grid in res_list)
            {
                foreach (var skill in my_chess.attribute.skill)
                {
                    if (skill == null)
                    {
                        continue;
                    }
                    //根据攻击生成行动方案
                    switch (skill.my_select_Solution)
                    {
                    case eSkill_Target_SelectSolution.Auto:
                        //随机攻击型
                        //按照可能击杀的数量和总体伤害计算
                        OpBySkill(ref op_list, skill, eDirection.All, grid);
                        break;

                    case eSkill_Target_SelectSolution.Human:
                        //制定攻击目标
                        //方向限制型
                        //按照可能击杀的数量和总体伤害计算
                        //每个方向进行一次选择
                        for (eDirection i = eDirection.UpperLeft; i < eDirection.All; i++)
                        {
                            OpBySkill(ref op_list, skill, i, grid);
                        }
                        break;

                    default:
                        break;
                    }
                }
                // 罗列攻击手段
                // 按攻击手段获得每一个格子上能打到的目标
                // 根据目标的血量和攻击手段获得攻击性相关行动数据
                //
                // 对产生的攻击方案,判断对方反击时会造成的伤害预期获得防御相关的行动数据
                // ps:上面这个运算需要一个整体的将来战局模拟数据
            }
            return(op_list);
        }