public CoverInfo ClearCover(CoverInfo cover) { if (cover != null) { cover.SetConfig(0); } return(cover); }
public List <CoverInfo> Timing() { List <CoverInfo> timerCovers = new List <CoverInfo>(); for (int i = 0; i < allCovers.Count; i++) { List <CoverInfo> xCovers = allCovers[i]; for (int j = 0; j < xCovers.Count; j++) { CoverInfo coverInfo = xCovers[j]; if (coverInfo.IsNull()) { coverInfo.timer = -1; } else if (coverInfo.timer > 0) { coverInfo.timer--; timerCovers.Add(coverInfo); if (coverInfo.timer == 0) { List <CoverInfo> covers = CoverModel.Instance.GetNeighbors(coverInfo); for (int n = 0; n < covers.Count; n++) { CoverInfo cover = covers[n]; if (cover != null) { if (cover.timer == -1) { CellInfo cellInfo = CellModel.Instance.GetCellByPos(cover.posX, cover.posY); if (cellInfo.isBlank == false && cellInfo.config.id == 10001) { } else { cover.SetConfig(coverInfo.config.GetSpecialValue(0)); } } } } coverInfo.SetConfig(0); } } } } return(timerCovers); }
public void InitFight() { FightModel.Instance.InitFightInfo(); CellInfo.start_x = crtBattle.start_x; MonsterModel.Instance.Destroy(); FloorModel.Instance.Destroy(); CellModel.Instance.Destroy(); WallModel.Instance.Destroy(); CoverModel.Instance.Destroy(); InvadeModel.Instance.Destroy(); int i; for (i = 0; i < crtBattle.battle_height; i++) { List <MonsterInfo> yMonsters = new List <MonsterInfo>(); 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>(); MonsterModel.Instance.allMonsters.Add(yMonsters); FloorModel.Instance.allFloors.Add(yFloors); CellModel.Instance.allCells.Add(yCells); WallModel.Instance.allWalls.Add(yWalls); CoverModel.Instance.allCovers.Add(yCovers); for (int j = 0; j < crtBattle.battle_width; j++) { BattleCellInfo battleCellInfo = crtBattle.allCells[i][j]; MonsterInfo monsterInfo = new MonsterInfo(); monsterInfo.configId = battleCellInfo.monster_id; monsterInfo.SetConfig(battleCellInfo.monster_id); monsterInfo.posX = j; monsterInfo.posY = i; yMonsters.Add(monsterInfo); FloorInfo floorInfo = new FloorInfo(); floorInfo.SetConfig(battleCellInfo.floor_id); floorInfo.posX = j; floorInfo.posY = i; yFloors.Add(floorInfo); CellInfo cellInfo = new CellInfo(); cellInfo.SetConfig(battleCellInfo.cell_id); cellInfo.posX = j; cellInfo.posY = i; yCells.Add(cellInfo); if (cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.changer) { cellInfo.changer = cellInfo.config.icon; cellInfo.SetConfig(cellInfo.config.hide_id); cellInfo.originalConfigId = cellInfo.config.hide_id; } if (cellInfo.config != null) { if (cellInfo.config.cell_type == (int)CellType.invade || cellInfo.config.id == 10007) { InvadeModel.Instance.AddInvade(cellInfo); } } CoverInfo coverInfo = new CoverInfo(); coverInfo.SetConfig(battleCellInfo.cover_id); coverInfo.posX = j; coverInfo.posY = i; yCovers.Add(coverInfo); List <WallInfo> xWalls = new List <WallInfo>(); for (int n = 0; n < 3; n++) { WallInfo wallInfo = new WallInfo(); wallInfo.SetConfig(battleCellInfo.walls[n]); wallInfo.posX = j; wallInfo.posY = i; wallInfo.posN = n; xWalls.Add(wallInfo); } yWalls.Add(xWalls); } } MonsterModel.Instance.RandomPos(); MonsterModel.Instance.HoldAll(); HideModel.Instance.LoadHider(); }
public bool UnLock(bool isJet = false) { if (IsNull()) { return(false); } if (config.monster_type == (int)MonsterType.blockade && !isJet) { CellInfo centerCell = CellModel.Instance.GetCellByPos(posX, posY); List <CellInfo> neighborCells = CellModel.Instance.GetNeighbors(centerCell); for (int i = 0; i < neighborCells.Count; i++) { CellInfo cell = neighborCells[i]; if (cell.isBlank == false) { return(false); } } Hold(false); releaseList = config.GetReleaseList(); if (releaseList.Count > 0) { releaseId = (int)releaseList[0].id; } else { releaseId = 0; } SetConfig(0); return(true); } if (config.monster_type == (int)MonsterType.bulb && !isJet) { if (progress > 0) { if (progress >= 1) { releaseList = config.GetReleaseList(); releaseId = (int)releaseList[0].id; if (!config.forever) { Hold(false); SetConfig(0); } } return(true); } return(false); } if (config.monster_type == (int)MonsterType.fall && !isJet) { if (banCount > 0) { banCount--; } releaseList = config.GetReleaseList(); releaseId = (int)releaseList[0].id; return(true); } if (config.monster_type == (int)MonsterType.flashlight && isJet) { CellInfo centerCell = CellModel.Instance.GetCellByPos(posX, posY); WallInfo gapWall = WallModel.Instance.GetGapWall(centerCell); if (gapWall != null) { releaseList = config.GetReleaseList(); if (releaseList.Count > 0) { releaseId = (int)releaseList[0].id; } else { releaseId = 0; } Hold(false); SetConfig(0); return(true); } return(false); } if (config.monster_type == (int)MonsterType.volcano && isJet) { bool coverIsOpen = CoverModel.Instance.IsOpen(posX, posY); if (coverIsOpen) { releaseList = config.GetReleaseList(); if (releaseList.Count > 0) { releaseId = (int)releaseList[0].id; } else { releaseId = 0; } if (config.forever) { CoverInfo cover = CoverModel.Instance.GetCoverByPos(posY, posX); cover.SetConfig(30008); } else { Hold(false); SetConfig(0); } return(true); } return(false); } return(false); }