-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLampFallArea.gd
53 lines (33 loc) · 1.28 KB
/
LampFallArea.gd
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
extends Area
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
export var unlockItemId = 3
var activated=false
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_LampFallArea_body_entered(body):
if activated:
return
if body.name == "Player": # hardcoded, whatever
var inventory = get_node("/root/Spatial/MarginContainer/CanvasLayer/Inventory")
#if true:
if inventory.contains(unlockItemId):
# TODO play sound effect
var lamp = get_node("/root/Spatial/Level/1og/wohnzimmer/lamp")
lamp.transform.basis = Basis(Vector3(0, 0, 1), -86.0*PI/180)
lamp.transform.origin.x -= 0.5
lamp.transform.origin.y += 0.148
var sparkles = get_node("/root/Spatial/Level/1og/wohnzimmer/Sparkles")
sparkles.show()
var sparklesAudio = get_node("/root/Spatial/Level/1og/wohnzimmer/Sparkles/AudioStreamPlayer3D")
sparklesAudio.play()
$AudioStreamPlayer3D.play()
activated = true
func _on_LampFallArea_body_exited(body):
if body.name == "Player": # hardcoded, whatever
var inventory = get_node("/root/Spatial/MarginContainer/CanvasLayer/Inventory")