rename AudioStreamPlayerPolyphonic to SoundEffectsPlayer
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/anthill.gd" id="1_8k02d"]
|
[ext_resource type="Script" path="res://scripts/anthill.gd" id="1_8k02d"]
|
||||||
[ext_resource type="Material" uid="uid://f0nlf4tdpvbd" path="res://resources/materials/indicators/hover_indicator_mat.tres" id="2_44p2d"]
|
[ext_resource type="Material" uid="uid://f0nlf4tdpvbd" path="res://resources/materials/indicators/hover_indicator_mat.tres" id="2_44p2d"]
|
||||||
[ext_resource type="Script" path="res://scripts/audio_stream_player_polyphonic.gd" id="3_vp3nf"]
|
[ext_resource type="Script" path="res://scripts/sound_effects_player.gd" id="3_vp3nf"]
|
||||||
|
|
||||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_x8apu"]
|
[sub_resource type="CapsuleMesh" id="CapsuleMesh_x8apu"]
|
||||||
|
|
||||||
@@ -35,6 +35,6 @@ mesh = SubResource("QuadMesh_2gykr")
|
|||||||
[node name="NavigationObstacle3D" type="NavigationObstacle3D" parent="."]
|
[node name="NavigationObstacle3D" type="NavigationObstacle3D" parent="."]
|
||||||
radius = 0.57
|
radius = 0.57
|
||||||
|
|
||||||
[node name="AudioStreamPlayerPolyphonic" type="AudioStreamPlayer3D" parent="."]
|
[node name="SoundEffectsPlayer" type="AudioStreamPlayer3D" parent="."]
|
||||||
unit_size = 20.0
|
unit_size = 20.0
|
||||||
script = ExtResource("3_vp3nf")
|
script = ExtResource("3_vp3nf")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/units/unit.gd" id="1_ulhs6"]
|
[ext_resource type="Script" path="res://scripts/units/unit.gd" id="1_ulhs6"]
|
||||||
[ext_resource type="Material" uid="uid://f0nlf4tdpvbd" path="res://resources/materials/indicators/hover_indicator_mat.tres" id="2_uk1jy"]
|
[ext_resource type="Material" uid="uid://f0nlf4tdpvbd" path="res://resources/materials/indicators/hover_indicator_mat.tres" id="2_uk1jy"]
|
||||||
[ext_resource type="Script" path="res://scripts/audio_stream_player_polyphonic.gd" id="3_wl62h"]
|
[ext_resource type="Script" path="res://scripts/sound_effects_player.gd" id="3_wl62h"]
|
||||||
|
|
||||||
[sub_resource type="QuadMesh" id="QuadMesh_igohi"]
|
[sub_resource type="QuadMesh" id="QuadMesh_igohi"]
|
||||||
material = ExtResource("2_uk1jy")
|
material = ExtResource("2_uk1jy")
|
||||||
@@ -45,5 +45,5 @@ transform = Transform3D(0.438547, 0, 0, 0, 0.438547, 0, 0, 0, 0.438547, 0, 0.906
|
|||||||
visible = false
|
visible = false
|
||||||
mesh = SubResource("BoxMesh_hvf81")
|
mesh = SubResource("BoxMesh_hvf81")
|
||||||
|
|
||||||
[node name="AudioStreamPlayerPolyphonic" type="AudioStreamPlayer3D" parent="."]
|
[node name="SoundEffectsPlayer" type="AudioStreamPlayer3D" parent="."]
|
||||||
script = ExtResource("3_wl62h")
|
script = ExtResource("3_wl62h")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/units/components/gathering.gd" id="1_ciwtf"]
|
[ext_resource type="Script" path="res://scripts/units/components/gathering.gd" id="1_ciwtf"]
|
||||||
[ext_resource type="Material" uid="uid://jkh5iskawwry" path="res://resources/materials/indicators/gathering_radius_mat.tres" id="2_r26em"]
|
[ext_resource type="Material" uid="uid://jkh5iskawwry" path="res://resources/materials/indicators/gathering_radius_mat.tres" id="2_r26em"]
|
||||||
[ext_resource type="Script" path="res://scripts/audio_stream_player_polyphonic.gd" id="4_alybx"]
|
[ext_resource type="Script" path="res://scripts/sound_effects_player.gd" id="4_alybx"]
|
||||||
|
|
||||||
[sub_resource type="QuadMesh" id="QuadMesh_ks8es"]
|
[sub_resource type="QuadMesh" id="QuadMesh_ks8es"]
|
||||||
material = ExtResource("2_r26em")
|
material = ExtResource("2_r26em")
|
||||||
@@ -22,5 +22,5 @@ cast_shadow = 0
|
|||||||
mesh = SubResource("QuadMesh_ks8es")
|
mesh = SubResource("QuadMesh_ks8es")
|
||||||
skeleton = NodePath("../..")
|
skeleton = NodePath("../..")
|
||||||
|
|
||||||
[node name="AudioStreamPlayerPolyphonic" type="AudioStreamPlayer3D" parent="."]
|
[node name="SoundEffectsPlayer" type="AudioStreamPlayer3D" parent="."]
|
||||||
script = ExtResource("4_alybx")
|
script = ExtResource("4_alybx")
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ var ant_gatherer := preload("res://scenes/units/ant_gatherer.tscn")
|
|||||||
@onready var ui_origin: Node3D = $UiOrigin
|
@onready var ui_origin: Node3D = $UiOrigin
|
||||||
@onready var nitwits_holder: Node = $/root/World/Units/Nitwits
|
@onready var nitwits_holder: Node = $/root/World/Units/Nitwits
|
||||||
@onready var gatherers_holder: Node = $/root/World/Units/Gatherers
|
@onready var gatherers_holder: Node = $/root/World/Units/Gatherers
|
||||||
@onready var audio_player: AudioStreamPlayerPolyphonic = (
|
@onready var audio_player: SoundEffectsPlayer = (
|
||||||
$AudioStreamPlayerPolyphonic
|
$SoundEffectsPlayer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -80,5 +80,5 @@ func _create_unit(unit_scene: PackedScene, cost: int) -> ControlledUnit:
|
|||||||
new_pos
|
new_pos
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
audio_player.play_polyphonic(SoundManager.ding())
|
audio_player.play_sound(SoundManager.ding())
|
||||||
return new_unit
|
return new_unit
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
extends AudioStreamPlayer3D
|
extends AudioStreamPlayer3D
|
||||||
class_name AudioStreamPlayerPolyphonic
|
class_name SoundEffectsPlayer
|
||||||
|
|
||||||
var playback: AudioStreamPlaybackPolyphonic
|
var playback: AudioStreamPlaybackPolyphonic
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ func _ready() -> void:
|
|||||||
play()
|
play()
|
||||||
playback = get_stream_playback()
|
playback = get_stream_playback()
|
||||||
|
|
||||||
func play_polyphonic(
|
func play_sound(
|
||||||
new_stream: AudioStream,
|
new_stream: AudioStream,
|
||||||
from_offset: float = 0,
|
from_offset: float = 0,
|
||||||
new_volume_db: float = 0,
|
new_volume_db: float = 0,
|
||||||
|
|||||||
23
scripts/sound_effects_player.gd
Normal file
23
scripts/sound_effects_player.gd
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
extends AudioStreamPlayer3D
|
||||||
|
class_name SoundEffectsPlayer
|
||||||
|
|
||||||
|
var playback: AudioStreamPlaybackPolyphonic
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
stream = AudioStreamPolyphonic.new()
|
||||||
|
play()
|
||||||
|
playback = get_stream_playback()
|
||||||
|
|
||||||
|
func play_sound(
|
||||||
|
new_stream: AudioStream,
|
||||||
|
from_offset: float = 0,
|
||||||
|
new_volume_db: float = 0,
|
||||||
|
new_pitch_scale: float = 1.0,
|
||||||
|
) -> void:
|
||||||
|
playback.play_stream(
|
||||||
|
new_stream,
|
||||||
|
from_offset,
|
||||||
|
new_volume_db,
|
||||||
|
new_pitch_scale,
|
||||||
|
)
|
||||||
@@ -36,8 +36,8 @@ var showing_after_set: bool = false
|
|||||||
@onready var radius_indicator: VisualInstance3D = (
|
@onready var radius_indicator: VisualInstance3D = (
|
||||||
$NearbyItemsSearch/GatheringRadius
|
$NearbyItemsSearch/GatheringRadius
|
||||||
)
|
)
|
||||||
@onready var audio_player: AudioStreamPlayerPolyphonic = (
|
@onready var audio_player: SoundEffectsPlayer = (
|
||||||
$AudioStreamPlayerPolyphonic
|
$SoundEffectsPlayer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -160,11 +160,11 @@ func _pick_up() -> void:
|
|||||||
|
|
||||||
carrying_items.append(target)
|
carrying_items.append(target)
|
||||||
target.set_carried(true)
|
target.set_carried(true)
|
||||||
audio_player.play_polyphonic(SoundManager.swoosh())
|
audio_player.play_sound(SoundManager.swoosh())
|
||||||
await target.start_moving(
|
await target.start_moving(
|
||||||
_get_nth_pile_pos(carrying_items.size() - 1)
|
_get_nth_pile_pos(carrying_items.size() - 1)
|
||||||
).moved
|
).moved
|
||||||
audio_player.play_polyphonic(SoundManager.pop())
|
audio_player.play_sound(SoundManager.pop())
|
||||||
|
|
||||||
await get_tree().create_timer(pickup_interval).timeout
|
await get_tree().create_timer(pickup_interval).timeout
|
||||||
if carrying_items.size() >= max_carrying or nearest == null:
|
if carrying_items.size() >= max_carrying or nearest == null:
|
||||||
@@ -186,9 +186,9 @@ func _deposit() -> void:
|
|||||||
return
|
return
|
||||||
|
|
||||||
var item := carrying_items.pop_back() as Honeydew
|
var item := carrying_items.pop_back() as Honeydew
|
||||||
audio_player.play_polyphonic(SoundManager.swoosh())
|
audio_player.play_sound(SoundManager.swoosh())
|
||||||
await item.start_moving(anthill.global_position).moved
|
await item.start_moving(anthill.global_position).moved
|
||||||
audio_player.play_polyphonic(SoundManager.tok())
|
audio_player.play_sound(SoundManager.tok())
|
||||||
item.remove_from_spawner()
|
item.remove_from_spawner()
|
||||||
_erase_honeydew(item)
|
_erase_honeydew(item)
|
||||||
item.queue_free()
|
item.queue_free()
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ var advance_anim_delta_accum: float = 0
|
|||||||
$VisibleOnScreenNotifier3D
|
$VisibleOnScreenNotifier3D
|
||||||
)
|
)
|
||||||
@onready var main_camera: MainCamera = $/root/World/MainCamera
|
@onready var main_camera: MainCamera = $/root/World/MainCamera
|
||||||
@onready var audio_player: AudioStreamPlayerPolyphonic = (
|
@onready var audio_player: SoundEffectsPlayer = (
|
||||||
$AudioStreamPlayerPolyphonic
|
$SoundEffectsPlayer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user