Esempio n. 1
0
    public void SwitchPos(CoverInfo coverInfo)
    {
        CoverInfo coverCopy = coverInfo.Copy();

        coverInfo.posX = posX;
        coverInfo.posY = posY;
        posX           = coverCopy.posX;
        posY           = coverCopy.posY;
    }
Esempio n. 2
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);
        }
    }