Skip to content

Commit

Permalink
Make FoW toggle toggling 'UnitVisibilityHandler'
Browse files Browse the repository at this point in the history
  • Loading branch information
Scony committed Nov 19, 2023
1 parent d90dac7 commit 9194f80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions source/match/debug/FogOfWarManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ extends PanelContainer

func _on_toggle_button_pressed():
_match.fog_of_war.visible = not _match.fog_of_war.visible
_match.find_child("UnitVisibilityHandler").visible = not (
_match.find_child("UnitVisibilityHandler").visible
)
6 changes: 5 additions & 1 deletion source/match/handlers/UnitVisibilityHandler.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ func _physics_process(_delta):
_recalcuate_orphaned_dummy_existence(orphaned_dummy, revealed_units)


func _is_disabled():
return not visible


func _recalculate_unit_visibility(unit, revealed_units = null):
if unit.is_in_group("revealed_units"):
if unit.is_in_group("revealed_units") or _is_disabled():
_update_unit_visibility(unit, true)
return

Expand Down

0 comments on commit 9194f80

Please sign in to comment.