34 lines
1.1 KiB
GDScript
34 lines
1.1 KiB
GDScript
extends StaticBody3D
|
|
|
|
var previous_vividness: float = 0
|
|
var toggle = false
|
|
var interactable = true
|
|
|
|
@onready var mesh: MeshInstance3D = $".".get_child(0)
|
|
@onready var collision: CollisionShape3D = $".".get_child(1)
|
|
#@onready var light: OmniLight3D = $".".get_child(2)
|
|
@onready var dream_test: Node = get_tree().get_first_node_in_group("Level")
|
|
@export var vivid_threshold : float = 50
|
|
|
|
@export var animation_player: AnimationPlayer
|
|
|
|
func _ready() -> void:
|
|
previous_vividness = dream_test.vividness
|
|
|
|
func _process(_delta: float) -> void:
|
|
##if the vividness is high enough the collision and mesh dissapear
|
|
if dream_test.vividness >= vivid_threshold and dream_test.vividness != previous_vividness:
|
|
## Set collision shape to zero effectively removing it
|
|
collision.disabled = true
|
|
mesh.visible = false
|
|
#if light != null:
|
|
#light.visible = false
|
|
elif dream_test.vividness < vivid_threshold and dream_test.vividness != previous_vividness:
|
|
collision.disabled = false
|
|
mesh.visible = true
|
|
#if light != null:
|
|
#light.visible = true
|
|
|
|
func interact():
|
|
dream_test.vividness = 60
|