Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Fog-Tile #326

Open
superfrantv opened this issue Dec 10, 2021 · 2 comments
Open

[Feature Request]: Fog-Tile #326

superfrantv opened this issue Dec 10, 2021 · 2 comments

Comments

@superfrantv
Copy link

Hello, i'am currently playing The Settlers 4 and there is a fog over the map where there are no troops from me. Is it possible to create a tile that automatically clears or deactivates the fog in certain places?

@ChuanXin-Unity
Copy link
Collaborator

I do not think Tiles themselves can automatically do that, since they do not update their logic continuously. You may have to rely on other scripts to update it, such as setting Tiles or removing them to simulate the Fog.

I would suggest making use of the SpriteMask component. The following could be how you do so:

  • Create a large SpriteRenderer/TilemapRenderer that acts as the Fog. Have it render on top of the Renderers you want to cover by changing the Sorting Layer and Order. Set the mask interaction to Visible Outside of Mask.
  • For each of your GameObjects that reveal the Fog, add a SpriteMask. The SpriteMask should have a Sprite that represents the area of Fog that you want to reveal. Set the Range Start and End such that the Sorting Layer and Order above for the Fog Renderer is in between the Range Start and End.
  • The GameObjects with the SpriteMask will make the parts of the Fog visible based on its position and the Sprite used.

If you have certain requirements for using Tiles specifically, do let us know!

@superfrantv
Copy link
Author

I think SpriteMask is a performance hitter, i currently do it with a extra tilemap and set each tile individual, the fog should only removed if any troop is in range, but should come back if the troop goes out of range.

i'am interested to use the ShaderGraph to make Hexagon Tiles become special effects like water animation or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants