Skip to content

Commit 74fe465

Browse files
Fix detecting hovered map tile after pathfinding while displaying a UI popup panel
1 parent 7ae9041 commit 74fe465

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Assets/Project/Scripts/Game Objects/Managers/Map Tile/HoveredMapTileManager.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
public class HoveredMapTileManager : MonoBehaviour, IPrimaryWindowElement, IMapEditingElement
55
{
66
public UnityEvent<MapTile> hoveredMapTileWasChangedEvent;
7-
7+
8+
private bool mapTileCanBeDetectedAfterPathfinding = true;
89
private bool mapTilesCanBeHovered = true;
910
private MapTile mapTile;
1011
#if !UNITY_ANDROID
@@ -19,6 +20,8 @@ public void SetPrimaryWindowElementActive(bool active)
1920
{
2021
SetMapTile(null);
2122
}
23+
24+
mapTileCanBeDetectedAfterPathfinding = active;
2225
}
2326

2427
public void SetMapEditingElementActive(bool active)
@@ -77,7 +80,7 @@ private void RegisterToListeners(bool register)
7780
#if !UNITY_ANDROID
7881
private void OnPathfindingProcessStateWasChanged(bool started)
7982
{
80-
if(!started && mapTileRaycaster != null && mapTileRaycaster.ComponentWasDetected(MouseMethods.GetMousePosition(), out var mapTile))
83+
if(!started && mapTileCanBeDetectedAfterPathfinding && mapTileRaycaster != null && mapTileRaycaster.ComponentWasDetected(MouseMethods.GetMousePosition(), out var mapTile))
8184
{
8285
SetMapTile(mapTile);
8386
}

0 commit comments

Comments
 (0)