I have a procedurally generated dungeon BSP on a Tilemap Grid. a TileMap collider has been added to it. I planned to do it simply, since my TileMap contain a SpriteRenderer, I add the color 0,0,0 to it like a black fog of war, and if I can't see it well or have already opened it i would repaint them with 0.5,0.5,0.5, and the area around the player would make 1, 1, 1. and that would be cool, BUT I only can get tiles from the map via VectorInt, or via an index and a copy of the array. Can I access each cell, somehow through a collider? To use something like Raycast or Overlap Colliders. any collider or collision tells me about the TileMap map. Or do I still need to create each tile and attach them to a game object or Scriptable object? I'm confused, tell me, I reviewed many tutorials and questions on this issue and got confused
问问题
535 次
1 回答
1
我不完全理解,但我很确定你想在运行时添加一个图块?或者你至少想改变瓷砖,让它变成黑色或战争迷雾?
首先,我找到了这个链接:如何通过脚本将瓷砖放置在瓷砖地图中
然而,这将是困难的,必须有某种阵列,或者可能是二维阵列,所有的瓷砖在不应该有战争迷雾的情况下。
我的建议是使用Sprite Mask,并将 tilemap(实际地面)设置为不与 mask 交互,并有一个大的战争精灵迷雾,就像一个可能跟随玩家的大黑云,这样它就不会需要是一个巨大的精灵,并将它的精灵交互设置为可见的外部蒙版。
最后,制作一个跟随玩家的精灵面具,从而消除玩家周围的战争迷雾。
另一件事是制作一个中间有一个洞的大云精灵,让它跟随玩家四处走动。那样的话,会有很大的战争迷雾,但中间有一个洞,所以迷雾不在玩家周围。
于 2021-05-31T14:23:02.830 回答