Support lines with any number of points #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've got a fork where I've refactored this and put in a variety of improvements for my game. This PR is accidentally all Zenject, so ignore the diff—the gist of it can be seen here or in the last commit:
The actual code changes to IsoSpriteSorting
.What does it do?
Adds support for lines of any length, and uses some trigonometry to compare points with line segments. This lets us configure sprites that would have previously required splitting, like this escalator:
What else?
It fixes a nasty sorting bug that resulted from trying to track the static sprites separate from movable sprites. There's actually no need for this separation, at least not in my testing—we can keep them all in the same list and rely on
transform.hasChanged
to identify the sprites that are moving efficiently. We can then remove theisMovable
property and greatly simplify some of the topological sorting code.What else???
Some quality of life improvements:
IComparable
to simplify the built-inList.Sort