/// <summary> /// Fills the specified room. /// </summary> public void FillRoom(int tileIndex, int roomIdx) { LogicTile tile = this._tiles[tileIndex]; if (tile.GetGameObjectCount() == 0) { // TODO Implement LogicTileMap::fillRoom. } }
/// <summary> /// Gets if the specified position is passable by path finder. /// </summary> public bool IsPassablePathFinder(int x, int y) { if (this._sizeX > x / 2 && this._sizeY > y / 2) { if (x / 2 + y / 2 >= 0) { LogicTile tile = this.GetTile(x / 2, y / 2); if (tile != null) { return(tile.IsPassablePathFinder(x % 2, y % 2)); } } } return(false); }
/// <summary> /// Gets if the specified position is a valid attack position. /// </summary> public bool IsValidAttackPos(int x, int y) { for (int i = 0, posX = x - 1; i < 2; i++, posX++) { for (int j = 0, posY = y - 1; j < 2; j++, posY++) { if (this._sizeX > posX && this._sizeY > posY) { if (posX > -1 && posY > -1) { LogicTile tile = this.GetTile(posX + i, posY + j); if (tile != null) { for (int k = 0; k < tile.GetGameObjectCount(); k++) { LogicGameObject gameObject = tile.GetGameObject(k); if (!gameObject.IsPassable()) { if (gameObject.GetGameObjectType() == 0) { LogicBuilding building = (LogicBuilding)gameObject; if (!building.GetBuildingData().Hidden) { return(false); } } } } } } } } } return(true); }
/// <summary> /// Updates all room indices. /// </summary> public void UpdateRoomIndices() { if (this._roomEnabled) { int tileCount = this._sizeX * this._sizeY; for (int i = 0; i < tileCount; i++) { LogicTile tmp = this._tiles[i]; tmp.SetRoomIdx(tmp.IsFullyNotPassable() ? -1 : 0); } for (int i = 0, roomId = 1; i < tileCount; i++) { LogicTile tmp = this._tiles[i]; if (tmp.GetGameObjectCount() == 0) { this.FillRoom(i, roomId++); } } } }