Beispiel #1
0
    //交换
    public void SwitchPos(CellInfo cellInfo)
    {
        CellInfo cellCopy = cellInfo.Copy();

        cellInfo.posX = posX;
        cellInfo.posY = posY;
        posX          = cellCopy.posX;
        posY          = cellCopy.posY;
    }
Beispiel #2
0
    //是否僵局
    public static bool IsDead()
    {
        List <List <CellInfo> > allCells     = CellModel.Instance.allCells;
        List <List <CellInfo> > tempAllCells = new List <List <CellInfo> >();

        int i;

        for (i = 0; i < BattleModel.Instance.crtBattle.ShowHeight(); i++)
        {
            List <CellInfo> xCells = allCells[i];
            tempAllCells.Add(new List <CellInfo>());
            for (int j = 0; j < xCells.Count; j++)
            {
                CellInfo cellInfo = xCells[j];

                if (cellInfo.isBlank == false && cellInfo.isMonsterHold == false && cellInfo.config.line_type > 0)
                {
                    CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(cellInfo.posY, cellInfo.posX);
                    if (coverInfo.CanLine())
                    {
                        tempAllCells[i].Add(cellInfo.Copy());
                    }
                    else
                    {
                        tempAllCells[i].Add(null);
                    }
                }
                else
                {
                    tempAllCells[i].Add(null);
                }

                if (cellInfo.isBlank == false && cellInfo.isMonsterHold == false && cellInfo.config.cell_type == (int)CellType.radiate)
                {
                    if (!RadiateCheck(allCells, cellInfo))
                    {
                        return(false);
                    }
                }
            }
        }
        return(RecursiveCheck(tempAllCells));
    }
Beispiel #3
0
    //复制
    public SkillEntityInfo Copy()
    {
        SkillEntityInfo skillEntityInfo = new SkillEntityInfo();

        skillEntityInfo.runId = runId;

        skillEntityInfo.seed = seed;

        skillEntityInfo.skill_x      = skill_x;
        skillEntityInfo.skill_y      = skill_y;
        skillEntityInfo.fightingType = fightingType;

        skillEntityInfo.cell         = cell.Copy();
        skillEntityInfo.controlCells = new List <CellInfo>();
        for (int i = 0; i < controlCells.Count; i++)
        {
            skillEntityInfo.controlCells.Add(controlCells[i].Copy());
        }

        return(skillEntityInfo);
    }
Beispiel #4
0
    private void Backup()
    {
        allFloorsBackup        = FloorModel.Instance.allFloors;
        allCellsBackup         = CellModel.Instance.allCells;
        allWallsBackup         = WallModel.Instance.allWalls;
        allCoversBackup        = CoverModel.Instance.allCovers;
        allMonstersBackup      = MonsterModel.Instance.allMonsters;
        lineCellsBackup        = CellModel.Instance.lineCells;
        rollbackCellBackup     = CellModel.Instance.rollbackCell;
        fighting_entitysBackup = SkillModel.Instance.fighting_entitys;

        FloorModel.Instance.allFloors        = new List <List <FloorInfo> >();
        CellModel.Instance.allCells          = new List <List <CellInfo> >();
        WallModel.Instance.allWalls          = new List <List <List <WallInfo> > >();
        CoverModel.Instance.allCovers        = new List <List <CoverInfo> >();
        MonsterModel.Instance.allMonsters    = new List <List <MonsterInfo> >();
        SkillModel.Instance.fighting_entitys = new List <SkillEntityInfo>();

        List <List <CellInfo> > allCells = allCellsBackup;
        int i;

        for (i = 0; i < allCells.Count; i++)
        {
            List <FloorInfo>        yFloors   = new List <FloorInfo>();
            List <CellInfo>         yCells    = new List <CellInfo>();
            List <List <WallInfo> > yWalls    = new List <List <WallInfo> >();
            List <CoverInfo>        yCovers   = new List <CoverInfo>();
            List <MonsterInfo>      yMonsters = new List <MonsterInfo>();

            FloorModel.Instance.allFloors.Add(yFloors);
            CellModel.Instance.allCells.Add(yCells);
            WallModel.Instance.allWalls.Add(yWalls);
            CoverModel.Instance.allCovers.Add(yCovers);
            MonsterModel.Instance.allMonsters.Add(yMonsters);

            List <CellInfo> xCells = allCells[i];
            for (int j = 0; j < xCells.Count; j++)
            {
                CellInfo cellInfo = xCells[j];
                yCells.Add(cellInfo.Copy());
                FloorInfo floorInfo = allFloorsBackup[cellInfo.posY][cellInfo.posX];
                yFloors.Add(floorInfo.Copy());
                CoverInfo coverInfo = allCoversBackup[cellInfo.posY][cellInfo.posX];
                yCovers.Add(coverInfo.Copy());
                MonsterInfo monsterInfo = allMonstersBackup[cellInfo.posY][cellInfo.posX];
                yMonsters.Add(monsterInfo.Copy());

                List <WallInfo> xWalls = new List <WallInfo>();
                yWalls.Add(xWalls);
                for (int n = 0; n < 3; n++)
                {
                    WallInfo wallInfo = allWallsBackup[cellInfo.posY][cellInfo.posX][n];
                    xWalls.Add(wallInfo.Copy());
                }
            }
        }

        CellModel.Instance.lineCells = new List <CellInfo>();
        for (i = 0; i < lineCellsBackup.Count; i++)
        {
            CellInfo cellInfo = lineCellsBackup[i];
            CellModel.Instance.lineCells.Add(CellModel.Instance.allCells[cellInfo.posY][cellInfo.posX]);
        }

        if (rollbackCellBackup == null)
        {
            CellModel.Instance.rollbackCell = null;
        }
        else
        {
            CellModel.Instance.rollbackCell = CellModel.Instance.allCells[rollbackCellBackup.posY][rollbackCellBackup.posX];
        }

        for (i = 0; i < fighting_entitysBackup.Count; i++)
        {
            SkillEntityInfo fighting_entity = fighting_entitysBackup[i];

            SkillEntityInfo fighting_entityCopy = fighting_entity.Copy();

            fighting_entityCopy.cell = CellModel.Instance.allCells[fighting_entityCopy.cell.posY][fighting_entityCopy.cell.posX];
            for (int j = 0; j < fighting_entityCopy.controlCells.Count; j++)
            {
                CellInfo controlCell = fighting_entityCopy.controlCells[j];
                fighting_entityCopy.controlCells[j] = CellModel.Instance.allCells[controlCell.posY][controlCell.posX];
            }

            SkillModel.Instance.fighting_entitys.Add(fighting_entityCopy);
        }
    }