2d-extras | Fun 2D Stuff that we 'd like to share | Canvas library
kandi X-RAY | 2d-extras Summary
kandi X-RAY | 2d-extras Summary
Fun 2D Stuff that we'd like to share!
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of 2d-extras
2d-extras Key Features
2d-extras Examples and Code Snippets
Community Discussions
Trending Discussions on 2d-extras
QUESTION
I'm looking for a way to create a new type of hexagonal rule tile to do something rather simple and specific. I want to create a hex rule tile capable of automatically choosing a sprite based on which other types of hexagonal tiles are adjacent to it. The default hexagonal rule tiles allow you to specify the sprite when a given tile is bordered by that same tile type on each side, but this is insufficient for my purposes.
What I ultimately want is to create a coast tile that will detect which sides are bordered by ocean tiles and choose the correct hex sprite based on that. Something like this, but with the ability to specify ocean tiles, not just the same tile type as indicated by the green arrows:
I can see Unity's default code for hexagonal rule tiles in their github repo, but have no idea how to go about overriding this exactly: https://github.com/Unity-Technologies/2d-extras/blob/master/Runtime/Tiles/HexagonalRuleTile/HexagonalRuleTile.cs
This is a relatively new subject in Unity, but any help or guidance would be much appreciated.
...ANSWER
Answered 2020-Mar-27 at 02:09Ok, figured this out after some deep googling and trial and error. All I needed was this inheriting class that overrides the RuleMatch method. Hopefully this will be useful to others.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install 2d-extras
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page