level bounds now don't error out on save/quit
This commit is contained in:
@@ -5,6 +5,8 @@ var level_collision_shapes : Array[CollisionShape3D]
|
||||
var check_collision = true
|
||||
|
||||
func _ready() -> void:
|
||||
SignalBus.player_exiting_tree.connect(player_exiting_tree)
|
||||
|
||||
for i in get_children():
|
||||
if i is CollisionShape3D:
|
||||
level_collision_shapes.append(i)
|
||||
@@ -18,8 +20,10 @@ func _on_body_exited(body: Node3D) -> void:
|
||||
body.global_position = body.last_ground_pos + Vector3(0,10,0)
|
||||
|
||||
func toggle_collision(collision_state):
|
||||
print("COLLISION STATE: ",collision_state)
|
||||
check_collision = collision_state
|
||||
if level_collision_shapes != null and level_collision_shapes != []:
|
||||
for i in level_collision_shapes:
|
||||
i.disabled = collision_state
|
||||
|
||||
func player_exiting_tree():
|
||||
toggle_collision(false)
|
||||
|
||||
Reference in New Issue
Block a user