File tree Expand file tree Collapse file tree
Assets/Project/Scripts/Game Objects/Managers/Map Tile Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using UnityEngine ;
22using UnityEngine . Events ;
33
4- public class HoveredMapTileManager : MonoBehaviour , IPrimaryWindowElement
4+ public class HoveredMapTileManager : MonoBehaviour , IPrimaryWindowElement , IMapEditingElement
55{
66 public UnityEvent < MapTile > hoveredMapTileWasChangedEvent ;
77
8+ private bool mapTilesCanBeHovered = true ;
89 private MapTile mapTile ;
910 private VisualiserEventsManager visualiserEventsManager ;
1011
@@ -16,6 +17,11 @@ public void SetPrimaryWindowElementActive(bool active)
1617 }
1718 }
1819
20+ public void SetMapEditingElementActive ( bool active )
21+ {
22+ mapTilesCanBeHovered = active ;
23+ }
24+
1925 private void Awake ( )
2026 {
2127 visualiserEventsManager = ObjectMethods . FindComponentOfType < VisualiserEventsManager > ( ) ;
@@ -48,7 +54,7 @@ private void RegisterToListeners(bool register)
4854
4955 private void OnEventWasSent ( VisualiserEvent visualiserEvent )
5056 {
51- if ( visualiserEvent is MapTileBoolVisualiserEvent mapTileBoolVisualiserEvent && mapTileBoolVisualiserEvent . GetVisualiserEventType ( ) == VisualiserEventType . MapTileHoverStateWasChanged )
57+ if ( mapTilesCanBeHovered && visualiserEvent is MapTileBoolVisualiserEvent mapTileBoolVisualiserEvent && mapTileBoolVisualiserEvent . GetVisualiserEventType ( ) == VisualiserEventType . MapTileHoverStateWasChanged )
5258 {
5359 SetMapTile ( mapTileBoolVisualiserEvent . GetBoolValue ( ) ? mapTileBoolVisualiserEvent . GetMapTile ( ) : null ) ;
5460 }
Original file line number Diff line number Diff line change 11using UnityEngine ;
22using UnityEngine . Events ;
33
4- public class SelectedMapTileManager : MonoBehaviour , IPrimaryWindowElement
4+ public class SelectedMapTileManager : MonoBehaviour , IPrimaryWindowElement , IMapEditingElement
55{
66 public UnityEvent < MapTile > selectedMapTileWasChangedEvent ;
77
8+ private bool mapTilesCanBeSelected = true ;
89 private MapTile mapTile ;
910 private VisualiserEventsManager visualiserEventsManager ;
1011
@@ -16,6 +17,11 @@ public void SetPrimaryWindowElementActive(bool active)
1617 }
1718 }
1819
20+ public void SetMapEditingElementActive ( bool active )
21+ {
22+ mapTilesCanBeSelected = active ;
23+ }
24+
1925 private void Awake ( )
2026 {
2127 visualiserEventsManager = ObjectMethods . FindComponentOfType < VisualiserEventsManager > ( ) ;
@@ -48,7 +54,7 @@ private void RegisterToListeners(bool register)
4854
4955 private void OnEventWasSent ( VisualiserEvent visualiserEvent )
5056 {
51- if ( visualiserEvent is MapTileBoolVisualiserEvent mapTileBoolVisualiserEvent && mapTileBoolVisualiserEvent . GetVisualiserEventType ( ) == VisualiserEventType . MapTileSelectionStateWasChanged )
57+ if ( mapTilesCanBeSelected && visualiserEvent is MapTileBoolVisualiserEvent mapTileBoolVisualiserEvent && mapTileBoolVisualiserEvent . GetVisualiserEventType ( ) == VisualiserEventType . MapTileSelectionStateWasChanged )
5258 {
5359 SetMapTile ( mapTileBoolVisualiserEvent . GetBoolValue ( ) ? mapTileBoolVisualiserEvent . GetMapTile ( ) : null ) ;
5460 }
You can’t perform that action at this time.
0 commit comments