Add daily dusk music cue
This commit is contained in:
parent
deab51a18a
commit
93c1cd4421
4 changed files with 90 additions and 0 deletions
BIN
audio/music/world/craft.mp3
Normal file
BIN
audio/music/world/craft.mp3
Normal file
Binary file not shown.
19
audio/music/world/craft.mp3.import
Normal file
19
audio/music/world/craft.mp3.import
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="mp3"
|
||||||
|
type="AudioStreamMP3"
|
||||||
|
uid="uid://c4y8puv0n6xk8"
|
||||||
|
path="res://.godot/imported/craft.mp3-ba8d0c0c16ba90585f5d8eb4f37eb87d.mp3str"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://audio/music/world/craft.mp3"
|
||||||
|
dest_files=["res://.godot/imported/craft.mp3-ba8d0c0c16ba90585f5d8eb4f37eb87d.mp3str"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
||||||
65
main/main.gd
65
main/main.gd
|
|
@ -96,6 +96,7 @@ const PlayerJobServiceType = preload("res://jobs/player_job_service.gd")
|
||||||
const NetworkJobServiceType = preload("res://network/network_job_service.gd")
|
const NetworkJobServiceType = preload("res://network/network_job_service.gd")
|
||||||
|
|
||||||
const TITLE_MUSIC_SILENCE_DB: float = -80.0
|
const TITLE_MUSIC_SILENCE_DB: float = -80.0
|
||||||
|
const TIME_CROSSING_EPSILON_HOURS: float = 0.000001
|
||||||
const PLAYER_MENU_PATTERN_SCALE: float = 0.85
|
const PLAYER_MENU_PATTERN_SCALE: float = 0.85
|
||||||
const PLAYER_MENU_PATTERN_SCROLL_VELOCITY := Vector2(-7.0, -5.0)
|
const PLAYER_MENU_PATTERN_SCROLL_VELOCITY := Vector2(-7.0, -5.0)
|
||||||
const SHOP_PATTERN_SCALE: float = 1.75
|
const SHOP_PATTERN_SCALE: float = 1.75
|
||||||
|
|
@ -120,6 +121,7 @@ const SHOP_PATTERN_SCALE: float = 1.75
|
||||||
)
|
)
|
||||||
@onready var _interface_fonts: InterfaceFontController = %InterfaceFontController
|
@onready var _interface_fonts: InterfaceFontController = %InterfaceFontController
|
||||||
@onready var _title_music: AudioStreamPlayer = %TitleMusic
|
@onready var _title_music: AudioStreamPlayer = %TitleMusic
|
||||||
|
@onready var _dusk_music: AudioStreamPlayer = %DuskMusic
|
||||||
@onready var _ui_pixelation: UIPixelationPresenterType = %UIPresentation
|
@onready var _ui_pixelation: UIPixelationPresenterType = %UIPresentation
|
||||||
@onready var _pixelation_reset: PixelationResetOverlayType = (
|
@onready var _pixelation_reset: PixelationResetOverlayType = (
|
||||||
%PixelationResetOverlay
|
%PixelationResetOverlay
|
||||||
|
|
@ -191,6 +193,7 @@ var _shop_interaction: FishingShopInteractionType
|
||||||
var _title_music_tween: Tween
|
var _title_music_tween: Tween
|
||||||
var _title_music_transition_generation: int = 0
|
var _title_music_transition_generation: int = 0
|
||||||
var _title_music_requested: bool = false
|
var _title_music_requested: bool = false
|
||||||
|
var _dusk_music_played_for_natural_day: bool = false
|
||||||
var _quit_in_progress: bool = false
|
var _quit_in_progress: bool = false
|
||||||
var _join_requested_from_title: bool = false
|
var _join_requested_from_title: bool = false
|
||||||
var _join_requested_from_pause: bool = false
|
var _join_requested_from_pause: bool = false
|
||||||
|
|
@ -316,6 +319,12 @@ func _initialize_after_data_root() -> void:
|
||||||
_world_weather,
|
_world_weather,
|
||||||
_player,
|
_player,
|
||||||
)
|
)
|
||||||
|
if not _world_time.natural_time_advanced.is_connected(
|
||||||
|
_on_natural_time_advanced
|
||||||
|
):
|
||||||
|
_world_time.natural_time_advanced.connect(
|
||||||
|
_on_natural_time_advanced
|
||||||
|
)
|
||||||
_network_world_time.setup(_network_session, _world_time)
|
_network_world_time.setup(_network_session, _world_time)
|
||||||
_network_world_weather.setup(_network_session, _world_weather)
|
_network_world_weather.setup(_network_session, _world_weather)
|
||||||
_player_jobs.setup(
|
_player_jobs.setup(
|
||||||
|
|
@ -1184,9 +1193,18 @@ func _reset_pixelation() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _set_gameplay_active(active: bool) -> void:
|
func _set_gameplay_active(active: bool) -> void:
|
||||||
|
var was_gameplay_started: bool = _gameplay_started
|
||||||
_gameplay_started = active
|
_gameplay_started = active
|
||||||
_shoreline_ambience.set_active(active)
|
_shoreline_ambience.set_active(active)
|
||||||
_rain_ambience.set_active(active)
|
_rain_ambience.set_active(active)
|
||||||
|
if active and not was_gameplay_started:
|
||||||
|
var current_hour: float = _world_time.get_time_hours()
|
||||||
|
_dusk_music_played_for_natural_day = (
|
||||||
|
current_hour >= WorldTimeServiceType.DUSK_START_HOUR
|
||||||
|
or current_hour < WorldTimeServiceType.DAWN_START_HOUR
|
||||||
|
)
|
||||||
|
elif not active:
|
||||||
|
_dusk_music.stop()
|
||||||
_title_background.visible = not active
|
_title_background.visible = not active
|
||||||
_world_pixelation.set_gameplay_active(active)
|
_world_pixelation.set_gameplay_active(active)
|
||||||
_ui_pixelation.set_gameplay_active(active)
|
_ui_pixelation.set_gameplay_active(active)
|
||||||
|
|
@ -1208,6 +1226,50 @@ func _set_gameplay_active(active: bool) -> void:
|
||||||
_set_shop_backdrop_visible(false)
|
_set_shop_backdrop_visible(false)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_natural_time_advanced(advanced_hours: float) -> void:
|
||||||
|
if not _gameplay_started or advanced_hours <= 0.0:
|
||||||
|
return
|
||||||
|
var current_hour: float = _world_time.get_time_hours()
|
||||||
|
var previous_hour: float = fposmod(
|
||||||
|
current_hour - advanced_hours,
|
||||||
|
WorldTimeServiceType.HOURS_PER_DAY,
|
||||||
|
)
|
||||||
|
if _natural_interval_crosses_hour(
|
||||||
|
previous_hour,
|
||||||
|
advanced_hours,
|
||||||
|
WorldTimeServiceType.DAWN_START_HOUR,
|
||||||
|
):
|
||||||
|
_dusk_music_played_for_natural_day = false
|
||||||
|
if (
|
||||||
|
not _dusk_music_played_for_natural_day
|
||||||
|
and _natural_interval_crosses_hour(
|
||||||
|
previous_hour,
|
||||||
|
advanced_hours,
|
||||||
|
WorldTimeServiceType.DUSK_START_HOUR,
|
||||||
|
)
|
||||||
|
):
|
||||||
|
_dusk_music_played_for_natural_day = true
|
||||||
|
_dusk_music.play(0.0)
|
||||||
|
|
||||||
|
|
||||||
|
static func _natural_interval_crosses_hour(
|
||||||
|
previous_hour: float,
|
||||||
|
advanced_hours: float,
|
||||||
|
target_hour: float,
|
||||||
|
) -> bool:
|
||||||
|
if advanced_hours >= WorldTimeServiceType.HOURS_PER_DAY:
|
||||||
|
return true
|
||||||
|
var distance_to_target: float = fposmod(
|
||||||
|
target_hour - previous_hour,
|
||||||
|
WorldTimeServiceType.HOURS_PER_DAY,
|
||||||
|
)
|
||||||
|
return (
|
||||||
|
distance_to_target > 0.0
|
||||||
|
and distance_to_target
|
||||||
|
<= advanced_hours + TIME_CROSSING_EPSILON_HOURS
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
func _set_player_menu_backdrop_visible(is_visible: bool) -> void:
|
func _set_player_menu_backdrop_visible(is_visible: bool) -> void:
|
||||||
if _player_menu_backdrop_tween != null:
|
if _player_menu_backdrop_tween != null:
|
||||||
_player_menu_backdrop_tween.kill()
|
_player_menu_backdrop_tween.kill()
|
||||||
|
|
@ -1687,6 +1749,9 @@ func _exit_tree() -> void:
|
||||||
if is_instance_valid(_title_music):
|
if is_instance_valid(_title_music):
|
||||||
_title_music.stop()
|
_title_music.stop()
|
||||||
_title_music.stream = null
|
_title_music.stream = null
|
||||||
|
if is_instance_valid(_dusk_music):
|
||||||
|
_dusk_music.stop()
|
||||||
|
_dusk_music.stream = null
|
||||||
|
|
||||||
|
|
||||||
func _on_shop_range_changed(in_range: bool) -> void:
|
func _on_shop_range_changed(in_range: bool) -> void:
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
[ext_resource type="Resource" path="res://items/catalog/item_catalog.tres" id="11_items"]
|
[ext_resource type="Resource" path="res://items/catalog/item_catalog.tres" id="11_items"]
|
||||||
[ext_resource type="Resource" path="res://economy/buyers/main_fishing_shop.tres" id="12_main_shop"]
|
[ext_resource type="Resource" path="res://economy/buyers/main_fishing_shop.tres" id="12_main_shop"]
|
||||||
[ext_resource type="AudioStream" uid="uid://bgkfluumuen4m" path="res://audio/music/title/as_in_four_wolves.ogg" id="13_title_music"]
|
[ext_resource type="AudioStream" uid="uid://bgkfluumuen4m" path="res://audio/music/title/as_in_four_wolves.ogg" id="13_title_music"]
|
||||||
|
[ext_resource type="AudioStream" path="res://audio/music/world/craft.mp3" id="dusk_music"]
|
||||||
[ext_resource type="Script" uid="uid://bdtb05vkiicd" path="res://ui/ui_pixelation_presenter.gd" id="14_pixelation"]
|
[ext_resource type="Script" uid="uid://bdtb05vkiicd" path="res://ui/ui_pixelation_presenter.gd" id="14_pixelation"]
|
||||||
[ext_resource type="PackedScene" path="res://ui/pixelation_reset_overlay.tscn" id="15_reset"]
|
[ext_resource type="PackedScene" path="res://ui/pixelation_reset_overlay.tscn" id="15_reset"]
|
||||||
[ext_resource type="PackedScene" path="res://main/world_pixelation_postprocess.tscn" id="16_world_pixelation"]
|
[ext_resource type="PackedScene" path="res://main/world_pixelation_postprocess.tscn" id="16_world_pixelation"]
|
||||||
|
|
@ -398,6 +399,11 @@ stream = ExtResource("13_title_music")
|
||||||
volume_db = -80.0
|
volume_db = -80.0
|
||||||
bus = &"Music"
|
bus = &"Music"
|
||||||
|
|
||||||
|
[node name="DuskMusic" type="AudioStreamPlayer" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
stream = ExtResource("dusk_music")
|
||||||
|
bus = &"Music"
|
||||||
|
|
||||||
[node name="ShorelineAmbience" type="Node" parent="." unique_id=1948037177]
|
[node name="ShorelineAmbience" type="Node" parent="." unique_id=1948037177]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
script = ExtResource("54_shoreline_ambience")
|
script = ExtResource("54_shoreline_ambience")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue