Skip to content

Commit

Permalink
Add deactivated cameras with hidden fov
Browse files Browse the repository at this point in the history
Fixes #128 > New Feature: Deactivated cameras no longer show field of view making it easier to tell which cameras are active
  • Loading branch information
DannyDarwiche committed Aug 6, 2021
1 parent 0e783ee commit 2057e1a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Scenes/Enemy/LeftCameraWithReceiver.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ shape = SubResource( 1 )

[node name="ReceiverCamera" parent="." instance=ExtResource( 5 )]
nodePaths = [ NodePath(".."), NodePath("../CameraHead/FieldOfView") ]
fovPolygonPath = NodePath("../CameraHead/FieldOfView/Polygon2D")

[editable path="CameraHead/FieldOfView"]
3 changes: 3 additions & 0 deletions Scenes/Enemy/RightCameraWithReceiver.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ shape = SubResource( 1 )

[node name="ReceiverCamera" parent="." instance=ExtResource( 5 )]
nodePaths = [ NodePath(".."), NodePath("../CameraHead/FieldOfView") ]
fovPolygonPath = NodePath("../CameraHead/FieldOfView/Polygon2D")

[editable path="CameraHead/FieldOfView"]
11 changes: 8 additions & 3 deletions Scripts/Interactables/ReceiverCamera.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ extends Node2D

export(int) var id := 0
export (Array, NodePath) var nodePaths
export(NodePath) var fovPolygonPath : NodePath

var active := false

func change_state() -> void:
active = not active
for nodePath in nodePaths:
if active:

if active:
get_node(fovPolygonPath).visible = false
for nodePath in nodePaths:
get_node(nodePath).set_process(false)
get_node(nodePath).set_physics_process(false)
else:
else:
get_node(fovPolygonPath).visible = true
for nodePath in nodePaths:
get_node(nodePath).set_process(true)
get_node(nodePath).set_physics_process(true)

0 comments on commit 2057e1a

Please sign in to comment.