diff options
Diffstat (limited to 'world/chunk/Chunk.gd')
-rw-r--r-- | world/chunk/Chunk.gd | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/world/chunk/Chunk.gd b/world/chunk/Chunk.gd index 1860c84..4356caf 100644 --- a/world/chunk/Chunk.gd +++ b/world/chunk/Chunk.gd @@ -3,15 +3,30 @@ extends Area enum LOD {DISTANCE,MID,CLOSE} var lod = -1 +onready var lod_distance = $"gen_tree/lod_distance" +onready var lod_mid = $"gen_tree/lod_mid" +onready var lod_close = $"gen_tree/lod_close" + +onready var _collision_enabled = lod_close.collision_layer + +func _ready(): + lod_update() + func lod_update(): - return - for obj in $"gen_tree".get_children(): - match lod: - LOD.CLOSE: - obj.lod_close() - LOD.MID: - obj.lod_mid() - LOD.DISTANCE: - obj.lod_distance() - _: - obj.lod_distance() + match lod: + LOD.CLOSE: + lod_distance.visible = false + lod_mid.visible = true + lod_close.collision_layer = _collision_enabled + LOD.MID: + lod_distance.visible = false + lod_mid.visible = true + lod_close.collision_layer = 0 + LOD.DISTANCE: + lod_distance.visible = true + lod_mid.visible = false + lod_close.collision_layer = 0 + _: + lod_distance.visible = true + lod_mid.visible = false + lod_close.collision_layer = 0 |