Implement TriggerOnCollision

This commit is contained in:
Matteo Tietz 2024-04-20 17:36:26 +02:00
parent fc17b636a2
commit 0e3a90149b
3 changed files with 13 additions and 15 deletions

View File

@ -22,7 +22,7 @@ _global_script_classes=[ {
"base": "Node", "base": "Node",
"class": "MusicChangedSlowAction", "class": "MusicChangedSlowAction",
"language": "GDScript", "language": "GDScript",
"path": "res://scripts/OnMusicChangedSlowTrigger.gd" "path": "res://scripts/TriggerOnMusicChangedSlow.gd"
}, { }, {
"base": "Action", "base": "Action",
"class": "PlaySound", "class": "PlaySound",
@ -35,6 +35,11 @@ _global_script_classes=[ {
"path": "res://scripts/Library/Actions/TriggerBase.gd" "path": "res://scripts/Library/Actions/TriggerBase.gd"
}, { }, {
"base": "TriggerBase", "base": "TriggerBase",
"class": "TriggerOnCollision",
"language": "GDScript",
"path": "res://scripts/Library/Actions/TriggerOnCollision.gd"
}, {
"base": "TriggerBase",
"class": "TriggerOnReady", "class": "TriggerOnReady",
"language": "GDScript", "language": "GDScript",
"path": "res://scripts/Library/Actions/TriggerOnReady.gd" "path": "res://scripts/Library/Actions/TriggerOnReady.gd"
@ -45,6 +50,7 @@ _global_script_class_icons={
"MusicChangedSlowAction": "", "MusicChangedSlowAction": "",
"PlaySound": "", "PlaySound": "",
"TriggerBase": "", "TriggerBase": "",
"TriggerOnCollision": "",
"TriggerOnReady": "" "TriggerOnReady": ""
} }

View File

@ -1,6 +1,9 @@
extends TriggerBase class_name TriggerOnCollision extends TriggerBase
export var collision_area export(NodePath) var collision_area
func _ready(): func _ready():
pass # Replace with function body. collision_area.connect("body_entered", self, "_on_body_entered")
func _on_body_entered(body: Node):
triggerAction(body)

View File

@ -1,11 +0,0 @@
class_name MusicChangedSlowAction extends Node
func _ready():
MusicSingleton.register_change_action(self)
MusicSingleton.change_music()
func _exit_tree():
MusicSingleton.unregister_change_action(self)
func execute() -> void:
print("Executed OnMusicChangedSlowAction")