예제 #1
0
    private void RecursiveControl(SkillEntityInfo skillEntityInfo, List <CellInfo> controlCells)
    {
        bool isHump = skillEntityInfo.cell.IsHump(skillEntityInfo.skill_x);

        if (skillEntityInfo.seed.open_holes == null)
        {
            if (skillEntityInfo.cell.config.cell_type == (int)CellType.line_bomb || skillEntityInfo.cell.config.cell_type == (int)CellType.line_bomb_r)
            {
                int rotate = skillEntityInfo.cell.config.rotate;
                if (skillEntityInfo.cell.rotate >= 0)
                {
                    rotate = skillEntityInfo.cell.rotate;
                }

                List <CellInfo> dir1Cells = CellModel.Instance.GetDirCells(skillEntityInfo.cell, (CellDirType)PosMgr.GetDirWithRotate(CellDirType.up, rotate), 3);
                List <CellInfo> dir2Cells = CellModel.Instance.GetDirCells(skillEntityInfo.cell, (CellDirType)PosMgr.GetDirWithRotate(CellDirType.down, rotate), 3);
                dir1Cells.InsertRange(dir1Cells.Count, dir2Cells);
                for (int i = 0; i < dir1Cells.Count; i++)
                {
                    CellInfo getCell = dir1Cells[i];
                    AddControl(getCell, skillEntityInfo, controlCells);
                }
            }

            if (skillEntityInfo.cell.config.cell_type == (int)CellType.three_bomb || skillEntityInfo.cell.config.cell_type == (int)CellType.three_bomb_r)
            {
                int rotate = skillEntityInfo.cell.config.rotate;
                if (skillEntityInfo.cell.rotate >= 0)
                {
                    rotate = skillEntityInfo.cell.rotate;
                }
                List <CellInfo> dir1Cells = CellModel.Instance.GetDirCells(skillEntityInfo.cell, (CellDirType)PosMgr.GetDirWithRotate(CellDirType.left_up, rotate), 2);
                List <CellInfo> dir2Cells = CellModel.Instance.GetDirCells(skillEntityInfo.cell, (CellDirType)PosMgr.GetDirWithRotate(CellDirType.down, rotate), 2);
                List <CellInfo> dir3Cells = CellModel.Instance.GetDirCells(skillEntityInfo.cell, (CellDirType)PosMgr.GetDirWithRotate(CellDirType.right_up, rotate), 2);
                dir1Cells.InsertRange(dir1Cells.Count, dir2Cells);
                dir1Cells.InsertRange(dir1Cells.Count, dir3Cells);
                for (int i = 0; i < dir1Cells.Count; i++)
                {
                    CellInfo getCell = dir1Cells[i];
                    AddControl(getCell, skillEntityInfo, controlCells);
                }
            }
        }
        else
        {
            for (int i = 0; i < skillEntityInfo.seed.open_holes.Count; i++)
            {
                int      holeIndex = skillEntityInfo.seed.open_holes[i];
                Vector2  holePos   = SkillTempletModel.Instance.GetHolePos(holeIndex + 1, isHump, skillEntityInfo.seed.dir);
                int      getx      = (int)(skillEntityInfo.skill_x + holePos.x);
                int      gety      = (int)(skillEntityInfo.skill_y - holePos.y);
                CellInfo getCell   = CellModel.Instance.GetCellByPos(getx, gety);
                AddControl(getCell, skillEntityInfo, controlCells);
            }
        }
    }