Closed longtran2904 closed 3 years ago
Each RoomInstance has an OutlinePolygon property which gives you an instance of Polygon2D class. And Polygon2D has a GetOutlinePoints() method to get all the points on the outline. These points already have the correct position so you don't have to add the position of the room to them.
But the GetOutlinePoints only return the corners a room. Is there a way to get all the outline points?
You're correct. The method is supposed to return all the outline points but it returns only the corners instead. I fixed the behaviour in the last commit and it'll be included in the next release.
In the meantime, you can manually apply the fix. To do so, locate the "Assets\Edgar\Runtime\Utils\Polygon2D.cs" file and replace its content with the following code - https://github.com/OndrejNepozitek/Edgar-Unity/blob/b8d9557337bc3826052d0f99291d3bb6d10d8130/Runtime/Utils/Polygon2D.cs. This step expects that you have the latest version of Edgar. If that's not the case, let me know.
Rather than replace it, you should have two functions, one for each.
There are now 3 functions:
GetPoints()
- returns corner points of the polygonGetOutlinePoints()
- returns outline points of the polygonGetAllPoints()
- returns all the points in the polygon (outline plus inside)You should change the name from GetPoints()
to GetCornerPoints()
I might change the names before I release the next update. The current naming is consistent with what's used in the underlying geometry types but you're correct that it may be better to use a different name to make the purpose of the method clearer.
In your level map tutorial in the dead cells example, you copy all the tiles of the wall layer. But I just want to copy the perimeter of the layer like in the Rogue Legacy map. How to do that?