Skip to content

Commit f4cd901

Browse files
Deselect hovered tile on Android platform when the pathfinding process simulation was started
1 parent 7c7401c commit f4cd901

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ public class HoveredMapTileManager : MonoBehaviour, IPrimaryWindowElement, IMapE
88
private bool mapTileCanBeDetectedAfterPathfinding = true;
99
private bool mapTilesCanBeHovered = true;
1010
private MapTile mapTile;
11-
#if !UNITY_ANDROID
1211
private MapPathManager mapPathManager;
12+
#if !UNITY_ANDROID
1313
private MapTileRaycaster mapTileRaycaster;
14+
#else
15+
private SimulationManager simulationManager;
1416
#endif
1517
private VisualiserEventsManager visualiserEventsManager;
1618

@@ -31,9 +33,11 @@ public void SetMapEditingElementActive(bool active)
3133

3234
private void Awake()
3335
{
34-
#if !UNITY_ANDROID
3536
mapPathManager = ObjectMethods.FindComponentOfType<MapPathManager>();
37+
#if !UNITY_ANDROID
3638
mapTileRaycaster = ObjectMethods.FindComponentOfType<MapTileRaycaster>();
39+
#else
40+
simulationManager = ObjectMethods.FindComponentOfType<SimulationManager>();
3741
#endif
3842
visualiserEventsManager = ObjectMethods.FindComponentOfType<VisualiserEventsManager>();
3943

@@ -49,12 +53,10 @@ private void RegisterToListeners(bool register)
4953
{
5054
if(register)
5155
{
52-
#if !UNITY_ANDROID
5356
if(mapPathManager != null)
5457
{
5558
mapPathManager.pathfindingProcessStateWasChangedEvent.AddListener(OnPathfindingProcessStateWasChanged);
5659
}
57-
#endif
5860

5961
if(visualiserEventsManager != null)
6062
{
@@ -63,12 +65,10 @@ private void RegisterToListeners(bool register)
6365
}
6466
else
6567
{
66-
#if !UNITY_ANDROID
6768
if(mapPathManager != null)
6869
{
6970
mapPathManager.pathfindingProcessStateWasChangedEvent.RemoveListener(OnPathfindingProcessStateWasChanged);
7071
}
71-
#endif
7272

7373
if(visualiserEventsManager != null)
7474
{
@@ -77,15 +77,20 @@ private void RegisterToListeners(bool register)
7777
}
7878
}
7979

80-
#if !UNITY_ANDROID
8180
private void OnPathfindingProcessStateWasChanged(bool started)
8281
{
82+
#if UNITY_ANDROID
83+
if(simulationManager != null && simulationManager.SimulationIsEnabled() && started && mapTile != null)
84+
{
85+
SetMapTile(null);
86+
}
87+
#else
8388
if(!started && mapTileCanBeDetectedAfterPathfinding && mapTileRaycaster != null && mapTileRaycaster.ComponentWasDetected(MouseMethods.GetMousePosition(), out var mapTile))
8489
{
8590
SetMapTile(mapTile);
8691
}
87-
}
8892
#endif
93+
}
8994

9095
private void OnEventWasSent(VisualiserEvent visualiserEvent)
9196
{

0 commit comments

Comments
 (0)