/** * Check if the given tile is a wall. * If it is, add it to the given graph reference. */ private static void ComputeWall(String name, int x, int y, ref Graph.Graph graph) { // Prepare the regex matcher. RegEx rgx = new RegEx(); rgx.Compile("^Wall([SOW])_([TLBR]{1})(Door)?.*$"); // Get and check the result of the regex. RegExMatch result = rgx.Search(name); if (result != null) { // Get the type of wall. Tile.WallType type = Tile.WallType.WOOD; switch (result.GetString(1)) { case "S": type = Tile.WallType.STONE; break; case "O": type = Tile.WallType.OBSIDIAN; break; case "W": type = Tile.WallType.WOOD; break; } Tile.Orientation dir = Tile.Orientation.OTHER; switch (result.GetString(2)) { case "T": dir = Tile.Orientation.TOP; break; case "B": dir = Tile.Orientation.BOTTOM; break; case "L": dir = Tile.Orientation.LEFT; break; case "R": dir = Tile.Orientation.RIGHT; break; } // Check if the given wall is a door. bool bIsDoor = result.GetString(3).Equals("Door"); // Create a new Wall instance. Tile.Wall wall = new Tile.Wall(type, bIsDoor, dir); wall.Position = new Vector2(x, y); // Add it to the graph object. graph.AddWall(wall, x, y); } }
private void DrawTileSpriteOrientationSelector() { _selectedOrientation = (Tile.Orientation)EditorGUILayout.EnumPopup("Orientation", _selectedOrientation); }