add ai, photo_mode and radio
This commit was merged in pull request #11.
This commit is contained in:
31
core/radio/radio.gd
Normal file
31
core/radio/radio.gd
Normal file
@@ -0,0 +1,31 @@
|
||||
extends AudioStreamPlayer
|
||||
|
||||
class_name Radio
|
||||
|
||||
@export var playlist: Array[AudioStream] = []
|
||||
var current_track_index: int = 0
|
||||
|
||||
func _ready():
|
||||
finished.connect(next_track)
|
||||
|
||||
func play_track(index: int = current_track_index):
|
||||
if playlist.is_empty():
|
||||
return
|
||||
|
||||
current_track_index = posmod(index, playlist.size())
|
||||
stream = playlist[current_track_index]
|
||||
play()
|
||||
stream_paused = false
|
||||
|
||||
func next_track():
|
||||
play_track(current_track_index + 1)
|
||||
|
||||
func prev_track():
|
||||
play_track(current_track_index - 1)
|
||||
|
||||
func toggle_pause():
|
||||
stream_paused = !stream_paused
|
||||
|
||||
func stop_radio():
|
||||
stop()
|
||||
stream_paused = false
|
||||
1
core/radio/radio.gd.uid
Normal file
1
core/radio/radio.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bwrgh6xlvhqch
|
||||
7
core/radio/radio.tscn
Normal file
7
core/radio/radio.tscn
Normal file
@@ -0,0 +1,7 @@
|
||||
[gd_scene format=3 uid="uid://cpeyt1dgrtglc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bwrgh6xlvhqch" path="res://core/radio/radio.gd" id="1_2akjj"]
|
||||
|
||||
[node name="Radio" type="AudioStreamPlayer" unique_id=1234112225]
|
||||
bus = &"Music"
|
||||
script = ExtResource("1_2akjj")
|
||||
Reference in New Issue
Block a user