public void DeleteFramesAndDoors(GameObject ceiling, int cityLayer, int layerPos, int yIndex, int xIndex, HexType[,,] tiles) { Vector2 point = new Vector2(xIndex, yIndex + 1); for (int direction = 0; direction < 6; direction++) { bool fromStairs = (cityLayer > 0) && HexHelp.CheckForStairs((int)point.x, (int)point.y, layerPos, tiles); if (Random.value <= openDoorChance || fromStairs) { GameObject.DestroyImmediate(ceiling.transform.Find(doorFrameNames[direction]).GetChild(0).gameObject); } //Delete frames if neighboring if (HexHelp.CheckDirRaw((int)point.x, (int)point.y, layerPos, tiles) && !HexHelp.CheckForStairs((int)point.x, (int)point.y, layerPos, tiles)) { GameObject.Destroy(ceiling.transform.Find(doorFrameNames[direction]).gameObject); } point = HexHelp.MoveInDirection(point, (HexDir)direction); } }