summaryrefslogtreecommitdiffstats
path: root/world/chunk/Chunk.gd
blob: 4356caf4c1659125dfd67ee1fe532f2ab5f8bf14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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():
    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