Added Actions
This commit is contained in:
parent
79a5b87a1c
commit
480a71a54d
|
@ -1,9 +1,13 @@
|
|||
[gd_scene load_steps=35 format=2]
|
||||
[gd_scene load_steps=39 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/OnMusicChangedSlowTrigger.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Scripts/Library/Actions/PlaySound.gd" type="Script" id=1]
|
||||
[ext_resource path="res://3d_platforma/golden_bay_512.hdr" type="Texture" id=2]
|
||||
[ext_resource path="res://Scripts/Library/Actions/Snare Admiral 2.wav" type="AudioStream" id=3]
|
||||
[ext_resource path="res://3d_platforma/sqare_norm.png" type="Texture" id=4]
|
||||
[ext_resource path="res://3d_platforma/texture_08.png" type="Texture" id=5]
|
||||
[ext_resource path="res://Scripts/Library/Actions/TriggerOnReady.gd" type="Script" id=6]
|
||||
[ext_resource path="res://Scripts/Library/Actions/ActionList.gd" type="Script" id=7]
|
||||
[ext_resource path="res://Scripts/Library/Actions/SFX BlackTiger.wav" type="AudioStream" id=8]
|
||||
|
||||
[sub_resource type="CubeMesh" id=1]
|
||||
|
||||
|
@ -565,5 +569,23 @@ light_energy = 0.65
|
|||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource( 24 )
|
||||
|
||||
[node name="MusicChangedSlowAction" type="Node" parent="."]
|
||||
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="."]
|
||||
stream = ExtResource( 3 )
|
||||
|
||||
[node name="AudioStreamPlayer3D2" type="AudioStreamPlayer3D" parent="."]
|
||||
stream = ExtResource( 8 )
|
||||
|
||||
[node name="TriggerOnReady" type="Node" parent="."]
|
||||
script = ExtResource( 6 )
|
||||
action = NodePath("../ActionList")
|
||||
|
||||
[node name="ActionList" type="Node" parent="."]
|
||||
script = ExtResource( 7 )
|
||||
|
||||
[node name="PlaySound" type="Node" parent="ActionList"]
|
||||
script = ExtResource( 1 )
|
||||
audioStreamPlayer = NodePath("../../AudioStreamPlayer3D")
|
||||
|
||||
[node name="PlaySound2" type="Node" parent="ActionList"]
|
||||
script = ExtResource( 1 )
|
||||
audioStreamPlayer = NodePath("../../AudioStreamPlayer3D2")
|
||||
|
|
|
@ -10,12 +10,42 @@ config_version=4
|
|||
|
||||
_global_script_classes=[ {
|
||||
"base": "Node",
|
||||
"class": "Action",
|
||||
"language": "GDScript",
|
||||
"path": "res://Scripts/Library/Actions/Action.gd"
|
||||
}, {
|
||||
"base": "Action",
|
||||
"class": "ActionList",
|
||||
"language": "GDScript",
|
||||
"path": "res://Scripts/Library/Actions/ActionList.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "MusicChangedSlowAction",
|
||||
"language": "GDScript",
|
||||
"path": "res://scripts/OnMusicChangedSlowTrigger.gd"
|
||||
"path": "res://Scripts/OnMusicChangedSlowTrigger.gd"
|
||||
}, {
|
||||
"base": "Action",
|
||||
"class": "PlaySound",
|
||||
"language": "GDScript",
|
||||
"path": "res://Scripts/Library/Actions/PlaySound.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "TriggerBase",
|
||||
"language": "GDScript",
|
||||
"path": "res://Scripts/Library/Actions/TriggerBase.gd"
|
||||
}, {
|
||||
"base": "TriggerBase",
|
||||
"class": "TriggerOnReady",
|
||||
"language": "GDScript",
|
||||
"path": "res://Scripts/Library/Actions/TriggerOnReady.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"MusicChangedSlowAction": ""
|
||||
"Action": "",
|
||||
"ActionList": "",
|
||||
"MusicChangedSlowAction": "",
|
||||
"PlaySound": "",
|
||||
"TriggerBase": "",
|
||||
"TriggerOnReady": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
@ -24,10 +54,6 @@ config/name="first_anniversary_godot_jam"
|
|||
run/main_scene="res://3d_platforma/Level.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[autoload]
|
||||
|
||||
MusicSingleton="*res://scripts/MusicSingleton.gd"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/width=480
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
class_name Action
|
||||
extends Node
|
||||
|
||||
func triggerNodePath( nodePath:NodePath ):
|
||||
|
||||
var a:Action = get_node( nodePath );
|
||||
triggerAction( a )
|
||||
|
||||
|
||||
func triggerAction( a:Action ):
|
||||
|
||||
if a == null:
|
||||
return
|
||||
|
||||
a.onTrigger()
|
||||
|
||||
func onTrigger():
|
||||
pass
|
|
@ -0,0 +1,12 @@
|
|||
class_name ActionList
|
||||
extends Action
|
||||
|
||||
|
||||
func onTrigger():
|
||||
var children = get_children()
|
||||
|
||||
for c in children:
|
||||
triggerAction( c )
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
class_name PlaySound
|
||||
extends Action
|
||||
|
||||
export(NodePath) var audioStreamPlayer
|
||||
|
||||
func _ready():
|
||||
onTrigger()
|
||||
|
||||
|
||||
func onTrigger():
|
||||
get_node( audioStreamPlayer ).play()
|
||||
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,18 @@
|
|||
class_name TriggerBase
|
||||
extends Node
|
||||
|
||||
|
||||
func triggerNodePath( nodePath:NodePath ):
|
||||
|
||||
var a:Action = get_node( nodePath );
|
||||
|
||||
triggerAction( a )
|
||||
|
||||
|
||||
|
||||
func triggerAction( a:Action ):
|
||||
|
||||
if a == null:
|
||||
return
|
||||
|
||||
a.onTrigger()
|
|
@ -0,0 +1,13 @@
|
|||
class_name TriggerOnReady
|
||||
extends TriggerBase
|
||||
|
||||
|
||||
export(NodePath) var action
|
||||
|
||||
func _ready():
|
||||
triggerNodePath( action )
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue