Work on audio players
This commit is contained in:
parent
cef7a1d582
commit
3c31ad66ac
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=13 format=2]
|
||||
[gd_scene load_steps=18 format=2]
|
||||
|
||||
[ext_resource path="res://3d_platforma/Player.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scripts/Library/Actions/Snare Admiral 2.wav" type="AudioStream" id=3]
|
||||
|
@ -7,7 +7,12 @@
|
|||
[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]
|
||||
[ext_resource path="res://Tape/Tape.tscn" type="PackedScene" id=9]
|
||||
[ext_resource path="res://Tape/TapeFast.tscn" type="PackedScene" id=9]
|
||||
[ext_resource path="res://Tape/TapeNormal.tscn" type="PackedScene" id=10]
|
||||
[ext_resource path="res://Tape/TapeSlow.tscn" type="PackedScene" id=11]
|
||||
[ext_resource path="res://scripts/RegisterAudioStreamPlayerSlow.gd" type="Script" id=12]
|
||||
[ext_resource path="res://scripts/RegisterAudioStreamPlayerFast.gd" type="Script" id=13]
|
||||
[ext_resource path="res://scripts/RegisterAudioStreamPlayerNormal.gd" type="Script" id=14]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=36]
|
||||
resource_name = "CheckerGrid"
|
||||
|
@ -222,5 +227,20 @@ script = ExtResource( 1 )
|
|||
[node name="PlaySound2" type="Node" parent="ActionList"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Tape" parent="." instance=ExtResource( 9 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2.1894 )
|
||||
[node name="TapeFast" parent="." instance=ExtResource( 9 )]
|
||||
transform = Transform( 0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, -1.34058, 0, -1.25926 )
|
||||
|
||||
[node name="TapeNormal" parent="." instance=ExtResource( 10 )]
|
||||
transform = Transform( 0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0.518271, 0, -1.35086 )
|
||||
|
||||
[node name="TapeSlow" parent="." instance=ExtResource( 11 )]
|
||||
transform = Transform( 0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 2.24, 0, -1.3138 )
|
||||
|
||||
[node name="AudioStreamPlayer3DSlow" type="AudioStreamPlayer3D" parent="."]
|
||||
script = ExtResource( 12 )
|
||||
|
||||
[node name="AudioStreamPlayer3DNormal" type="AudioStreamPlayer3D" parent="."]
|
||||
script = ExtResource( 14 )
|
||||
|
||||
[node name="AudioStreamPlayer3DFast" type="AudioStreamPlayer3D" parent="."]
|
||||
script = ExtResource( 13 )
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/SetFastMusic.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Tape/tape.obj" type="ArrayMesh" id=2]
|
||||
[ext_resource path="res://scripts/Library/Actions/TriggerOnCollision.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="BoxShape" id=1]
|
||||
|
||||
[node name="TapeFast" type="Spatial"]
|
||||
transform = Transform( 0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0, 0, 0 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
mesh = ExtResource( 2 )
|
||||
|
||||
[node name="Area" type="Area" parent="."]
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Area"]
|
||||
transform = Transform( 0.240864, 0, 0, 0, 1, 0, 0, 0, 1.66505, 0, 0, 0 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="TriggerOnCollision" type="Node" parent="Area"]
|
||||
script = ExtResource( 3 )
|
||||
collision_area = NodePath("..")
|
||||
action = NodePath("../SetFastMusic")
|
||||
|
||||
[node name="SetFastMusic" type="Node" parent="Area"]
|
||||
script = ExtResource( 1 )
|
|
@ -0,0 +1,27 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/SetNormalMusic.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Tape/tape.obj" type="ArrayMesh" id=2]
|
||||
[ext_resource path="res://scripts/Library/Actions/TriggerOnCollision.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="BoxShape" id=1]
|
||||
|
||||
[node name="TapeNormal" type="Spatial"]
|
||||
transform = Transform( 0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0, 0, 0 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
mesh = ExtResource( 2 )
|
||||
|
||||
[node name="Area" type="Area" parent="."]
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Area"]
|
||||
transform = Transform( 0.240864, 0, 0, 0, 1, 0, 0, 0, 1.66505, 0, 0, 0 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="TriggerOnCollision" type="Node" parent="Area"]
|
||||
script = ExtResource( 3 )
|
||||
collision_area = NodePath("..")
|
||||
action = NodePath("../SetNormalMusic")
|
||||
|
||||
[node name="SetNormalMusic" type="Node" parent="Area"]
|
||||
script = ExtResource( 1 )
|
|
@ -2,11 +2,12 @@
|
|||
|
||||
[ext_resource path="res://Tape/tape.obj" type="ArrayMesh" id=1]
|
||||
[ext_resource path="res://scripts/Library/Actions/TriggerOnCollision.gd" type="Script" id=2]
|
||||
[ext_resource path="res://scripts/Library/Actions/PlaySound.gd" type="Script" id=3]
|
||||
[ext_resource path="res://scripts/SetSlowMusic.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="BoxShape" id=1]
|
||||
|
||||
[node name="Tape" type="Spatial"]
|
||||
[node name="TapeSlow" type="Spatial"]
|
||||
transform = Transform( 0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0, 0, 0 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
mesh = ExtResource( 1 )
|
||||
|
@ -20,7 +21,7 @@ shape = SubResource( 1 )
|
|||
[node name="TriggerOnCollision" type="Node" parent="Area"]
|
||||
script = ExtResource( 2 )
|
||||
collision_area = NodePath("..")
|
||||
action = NodePath("../PlaySound")
|
||||
action = NodePath("../SetSlowMusic")
|
||||
|
||||
[node name="PlaySound" type="Node" parent="Area"]
|
||||
[node name="SetSlowMusic" type="Node" parent="Area"]
|
||||
script = ExtResource( 3 )
|
|
@ -133,5 +133,4 @@ common/enable_pause_aware_picking=true
|
|||
|
||||
[rendering]
|
||||
|
||||
quality/driver/driver_name="GLES2"
|
||||
environment/default_environment="res://default_env.tres"
|
||||
|
|
|
@ -8,6 +8,5 @@ func _ready():
|
|||
|
||||
|
||||
func onTrigger():
|
||||
print("OnTrigger PlaySound")
|
||||
# get_node( audioStreamPlayer ).play()
|
||||
get_node( audioStreamPlayer ).play()
|
||||
|
||||
|
|
|
@ -6,6 +6,10 @@ func _ready() -> void:
|
|||
var change_slow_actions : Array = []
|
||||
var gameSpeed : float = 1;
|
||||
var musicType: int = 0;
|
||||
var audio_player_slow : AudioStreamPlayer3D
|
||||
var audio_player_normal : AudioStreamPlayer3D
|
||||
var audio_player_fast : AudioStreamPlayer3D
|
||||
var current_audio_player : AudioStreamPlayer3D
|
||||
|
||||
func setSlowMusic():
|
||||
setMusicType( -1 )
|
||||
|
@ -19,7 +23,15 @@ func setNormalMusic():
|
|||
func setMusicType( type:int ):
|
||||
musicType = type;
|
||||
|
||||
gameSpeed = 0
|
||||
if type == 0:
|
||||
gameSpeed = 0
|
||||
|
||||
# current_playback_position : float = 0.0
|
||||
# if current_audio_player:
|
||||
# current_audio_player.stop()
|
||||
# current_playback_position = current_audio_player.get_playback_position()
|
||||
# current_playback_position = current_audio_player.get_playback_position()
|
||||
# current_playback_position = current_audio_player.get_playback_position()
|
||||
|
||||
if type == 1:
|
||||
gameSpeed = 2
|
||||
|
@ -39,3 +51,16 @@ func unregister_change_action(change_action : Node) -> void:
|
|||
func change_music() -> void:
|
||||
for change_action in change_slow_actions:
|
||||
change_action.execute()
|
||||
|
||||
func register_audio_player_slow(audio_player : AudioStreamPlayer3D) -> void:
|
||||
print("Registered audio stream player fast")
|
||||
audio_player_slow = audio_player
|
||||
|
||||
func register_audio_player_normal(audio_player : AudioStreamPlayer3D) -> void:
|
||||
print("Registered audio stream player normal")
|
||||
audio_player_normal = audio_player
|
||||
|
||||
func register_audio_player_fast(audio_player : AudioStreamPlayer3D) -> void:
|
||||
print("Registered audio stream player fast")
|
||||
audio_player_fast = audio_player
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
extends AudioStreamPlayer3D
|
||||
|
||||
|
||||
func _ready():
|
||||
MusicSingleton.register_audio_player_fast(self)
|
|
@ -0,0 +1,5 @@
|
|||
extends AudioStreamPlayer3D
|
||||
|
||||
|
||||
func _ready():
|
||||
MusicSingleton.register_audio_player_normal(self)
|
|
@ -0,0 +1,5 @@
|
|||
extends AudioStreamPlayer3D
|
||||
|
||||
|
||||
func _ready():
|
||||
MusicSingleton.register_audio_player_slow(self)
|
Loading…
Reference in New Issue