public bool IsOpen(int posx, int posy) { CoverInfo cover = GetCoverByPos(posy, posx); if (cover == null) { return(true); } return(cover.IsOpen()); }
private void RecursionRoadCrawl() { if (crawlCount > 0) { CellInfo centerCell = CellModel.Instance.GetCellByPos(posX, posY); List <CellInfo> cellNeighbors = CellModel.Instance.GetNeighbors(centerCell); CellInfo findCellPoint = null; for (int i = 0; i < cellNeighbors.Count; i++) { CellInfo cellNeighbor = cellNeighbors[i]; if (cellNeighbor == null) { continue; } if (cellNeighbor.CanCrawl() == false) { continue; } CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(cellNeighbor.posY, cellNeighbor.posY); if (coverInfo != null && coverInfo.IsOpen() == false) { continue; } WallInfo wall = WallModel.Instance.GetWall(centerCell, cellNeighbor); if (wall.IsNull() == false) { continue; } BattleCellInfo bcellInfo = BattleModel.Instance.crtBattle.GetBattleCellByPos(cellNeighbor.posX, cellNeighbor.posY); if (bcellInfo.bg_id != special1) { continue; } bool isPassed = false; for (int j = 0; j < crawlPassPoints.Count; j++) { Vector2 passPoint = crawlPassPoints[j]; if (passPoint.x == cellNeighbor.posX && passPoint.y == cellNeighbor.posY) { isPassed = true; break; } } if (isPassed == false) { findCellPoint = cellNeighbor; break; } } if (findCellPoint != null) { Hold(false); MonsterInfo toMonsterInfo = MonsterModel.Instance.GetMonsterByPos(findCellPoint.posY, findCellPoint.posX); MonsterModel.Instance.SwitchPos(this, toMonsterInfo); this.SwitchPos(toMonsterInfo); Hold(); crawlCount--; crawlPassPoints.Add(new Vector2(findCellPoint.posX, findCellPoint.posY)); MonsterModel.Instance.AddCrawAnim(this, findCellPoint); if (crawlCount > 0) { RecursionRoadCrawl(); } } } }
public void RecursionRandomCrawl() { if (crawlCount > 0) { CellInfo centerCell = CellModel.Instance.GetCellByPos(posX, posY); CellInfo findCellPoint = null; List <CellDirType> priorityDirList = PosMgr.PriorityDirList((int)randomCrawlDir, true); for (int i = 0; i < priorityDirList.Count; i++) { CellDirType dir = priorityDirList[i]; CellInfo dirCell = CellModel.Instance.GetDirCell(centerCell, dir); if (dirCell == null) { continue; } if (dirCell.CanCrawl() == false) { continue; } CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(dirCell.posY, dirCell.posY); if (coverInfo != null && coverInfo.IsOpen() == false) { continue; } WallInfo wall = WallModel.Instance.GetWall(centerCell, dirCell); if (wall.IsNull() == false) { continue; } randomCrawlDir = dir; findCellPoint = dirCell; break; } if (findCellPoint != null) { Hold(false); MonsterInfo toMonsterInfo = MonsterModel.Instance.GetMonsterByPos(findCellPoint.posY, findCellPoint.posX); MonsterModel.Instance.SwitchPos(this, toMonsterInfo); this.SwitchPos(toMonsterInfo); Hold(); crawlCount--; MonsterModel.Instance.AddCrawAnim(this, findCellPoint); if (crawlCount > 0) { //RecursionRandomCrawl(); } } else { crawlCount--; MonsterModel.Instance.AddCrawAnim(this, centerCell); } } }