Compare commits
2 Commits
polish8
...
whitleands
| Author | SHA1 | Date | |
|---|---|---|---|
| 22653d62bc | |||
| 6a2a2d2e8a |
@@ -1,7 +1,7 @@
|
|||||||
extends Path3D
|
extends Path3D
|
||||||
|
|
||||||
const STEAM_DISTANCE_STAT: String = "stat_distance_km"
|
const STEAM_DISTANCE_STAT: String = "stat_distance_km"
|
||||||
const STEAM_DISTANCE_KM_PER_UNIT: float = 1#0.001
|
const DISTANCE_KM_PER_UNIT: float = 0.001
|
||||||
|
|
||||||
@export_group("Train")
|
@export_group("Train")
|
||||||
##train speed
|
##train speed
|
||||||
@@ -395,7 +395,7 @@ func _track_steam_distance(distance_units: float) -> void:
|
|||||||
if distance_units <= 0.0 or not SteamManager.is_on_steam:
|
if distance_units <= 0.0 or not SteamManager.is_on_steam:
|
||||||
return
|
return
|
||||||
|
|
||||||
_pending_steam_distance_km += distance_units * STEAM_DISTANCE_KM_PER_UNIT
|
_pending_steam_distance_km += distance_units * DISTANCE_KM_PER_UNIT
|
||||||
var whole_km: int = int(floor(_pending_steam_distance_km))
|
var whole_km: int = int(floor(_pending_steam_distance_km))
|
||||||
if whole_km <= 0:
|
if whole_km <= 0:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,52 +1,57 @@
|
|||||||
extends VBoxContainer
|
extends VBoxContainer
|
||||||
|
|
||||||
@onready var color_pickers: Array[TrainColorPicker] = [$%ColorPicker1, $%ColorPicker2, $%ColorPicker3, $%ColorPicker4, $%ColorPicker5, $%ColorPicker6]
|
@onready var color_pickers_1: Array[TrainColorPicker] = [$%ColorPicker1, $%ColorPicker2, $%ColorPicker3, $%ColorPicker4, $%ColorPicker5, $%ColorPicker6]
|
||||||
@onready var left_arrow: ArrowButton = $%ArrowButtonLeft
|
@onready var color_pickers_2: Array[TrainColorPicker] = [$%ColorPicker7, $%ColorPicker8, $%ColorPicker9, $%ColorPicker10, $%ColorPicker11, $%ColorPicker12]
|
||||||
@onready var right_arrow: ArrowButton = $%ArrowButtonRight
|
|
||||||
@onready var treno: Node3D = $TrainViewportContainer/SubViewport/Treno
|
@onready var treno: Node3D = $TrainViewportContainer/SubViewport/Treno
|
||||||
|
|
||||||
var selected_color: Color
|
var selected_color: Color
|
||||||
var selected_color_index: int = 0
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
for color_picker in color_pickers:
|
for color_picker in color_pickers_1:
|
||||||
color_picker.pressed.connect(_on_color_selected.bind(color_picker))
|
color_picker.pressed.connect(_on_color_selected.bind(color_picker, 0))
|
||||||
color_picker.deselect()
|
color_picker.deselect()
|
||||||
|
|
||||||
_set_selected_color(0)
|
var init_idx_1 = GameState.save_data.train_color_1_index
|
||||||
|
_set_selected_color(init_idx_1, 0)
|
||||||
|
|
||||||
left_arrow.pressed.connect(_select_prev_color)
|
for color_picker in color_pickers_2:
|
||||||
right_arrow.pressed.connect(_select_next_color)
|
color_picker.pressed.connect(_on_color_selected.bind(color_picker, 1))
|
||||||
|
color_picker.deselect()
|
||||||
|
|
||||||
|
var init_idx_2 = GameState.save_data.train_color_2_index
|
||||||
|
_set_selected_color(init_idx_2, 1)
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if treno:
|
if treno:
|
||||||
treno.rotation_degrees.y += 30.0 * delta
|
treno.rotation_degrees.y += 30.0 * delta
|
||||||
|
|
||||||
func _set_selected_color(index: int) -> void:
|
func _set_selected_color(index: int, material_index: int) -> void:
|
||||||
|
var color_pickers = color_pickers_1 if material_index == 0 else color_pickers_2
|
||||||
for i in range(color_pickers.size()):
|
for i in range(color_pickers.size()):
|
||||||
if i == index:
|
if i == index:
|
||||||
color_pickers[i].select()
|
color_pickers[i].select()
|
||||||
selected_color_index = i
|
|
||||||
selected_color = color_pickers[i].color
|
selected_color = color_pickers[i].color
|
||||||
_apply_train_color(selected_color)
|
_apply_train_color(selected_color, material_index, index)
|
||||||
else:
|
else:
|
||||||
color_pickers[i].deselect()
|
color_pickers[i].deselect()
|
||||||
|
|
||||||
func _on_color_selected(selected_color_picker: TrainColorPicker) -> void:
|
func _on_color_selected(selected_color_picker: TrainColorPicker, material_index: int) -> void:
|
||||||
|
var color_pickers = color_pickers_1 if material_index == 0 else color_pickers_2
|
||||||
for i in range(color_pickers.size()):
|
for i in range(color_pickers.size()):
|
||||||
if color_pickers[i] == selected_color_picker:
|
if color_pickers[i] == selected_color_picker:
|
||||||
_set_selected_color(i)
|
_set_selected_color(i, material_index)
|
||||||
break
|
break
|
||||||
|
|
||||||
func _select_prev_color() -> void:
|
func _apply_train_color(color: Color, material_index: int, color_index: int = 0) -> void:
|
||||||
var next_index = (selected_color_index - 1 + color_pickers.size()) % color_pickers.size()
|
var path = "res://tgcc/train/Color%s_train.tres" % ("1" if material_index == 0 else "2")
|
||||||
_set_selected_color(next_index)
|
var mat: ShaderMaterial = load(path)
|
||||||
|
|
||||||
func _select_next_color() -> void:
|
|
||||||
var next_index = (selected_color_index + 1) % color_pickers.size()
|
|
||||||
_set_selected_color(next_index)
|
|
||||||
|
|
||||||
func _apply_train_color(color: Color) -> void:
|
|
||||||
var mat: ShaderMaterial = load("res://tgcc/train/Color1_train.tres")
|
|
||||||
if mat:
|
if mat:
|
||||||
mat.set_shader_parameter("albedo_color", color)
|
mat.set_shader_parameter("albedo_color", color)
|
||||||
|
|
||||||
|
if material_index == 0:
|
||||||
|
GameState.save_data.train_color_1 = color.to_html()
|
||||||
|
GameState.save_data.train_color_1_index = color_index
|
||||||
|
else:
|
||||||
|
GameState.save_data.train_color_2 = color.to_html()
|
||||||
|
GameState.save_data.train_color_2_index = color_index
|
||||||
|
GameState.save_game()
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ func _ready() -> void:
|
|||||||
deselect()
|
deselect()
|
||||||
disable()
|
disable()
|
||||||
|
|
||||||
func set_option_text(text: String) -> void:
|
func set_option_text(_text: String) -> void:
|
||||||
if label == null:
|
if label == null:
|
||||||
label = $%Label
|
label = $%Label
|
||||||
label.text = text
|
label.text = _text
|
||||||
|
|
||||||
func select() -> void:
|
func select() -> void:
|
||||||
if checkbox == null:
|
if checkbox == null:
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ func apply_video_settings() -> void:
|
|||||||
get_viewport().use_taa = save_data.anti_aliasing
|
get_viewport().use_taa = save_data.anti_aliasing
|
||||||
var msaa_mode = Viewport.MSAA_2X if save_data.anti_aliasing else Viewport.MSAA_DISABLED
|
var msaa_mode = Viewport.MSAA_2X if save_data.anti_aliasing else Viewport.MSAA_DISABLED
|
||||||
get_viewport().msaa_3d = msaa_mode
|
get_viewport().msaa_3d = msaa_mode
|
||||||
get_viewport().msaa_2d = msaa_mode
|
get_viewport().msaa_2d = Viewport.MSAA_DISABLED
|
||||||
|
|
||||||
match save_data.window_mode_index:
|
match save_data.window_mode_index:
|
||||||
0:
|
0:
|
||||||
@@ -49,9 +49,18 @@ func apply_video_settings() -> void:
|
|||||||
DisplayServer.window_set_size(Vector2i(save_data.resolution_x, save_data.resolution_y))
|
DisplayServer.window_set_size(Vector2i(save_data.resolution_x, save_data.resolution_y))
|
||||||
|
|
||||||
# Optional: center the window if resized
|
# Optional: center the window if resized
|
||||||
var screen_center = DisplayServer.screen_get_position() + DisplayServer.screen_get_size() / 2
|
var screen_position: Vector2i = DisplayServer.screen_get_position()
|
||||||
var window_size = DisplayServer.window_get_size()
|
var screen_size: Vector2i = DisplayServer.screen_get_size()
|
||||||
DisplayServer.window_set_position(screen_center - window_size / 2)
|
var window_size: Vector2i = DisplayServer.window_get_size()
|
||||||
|
var screen_center := screen_position + Vector2i(
|
||||||
|
floori(float(screen_size.x) / 2.0),
|
||||||
|
floori(float(screen_size.y) / 2.0)
|
||||||
|
)
|
||||||
|
var window_half_size := Vector2i(
|
||||||
|
floori(float(window_size.x) / 2.0),
|
||||||
|
floori(float(window_size.y) / 2.0)
|
||||||
|
)
|
||||||
|
DisplayServer.window_set_position(screen_center - window_half_size)
|
||||||
|
|
||||||
|
|
||||||
func save_game() -> void:
|
func save_game() -> void:
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
@onready var game_menu: Control = $%GameMenu
|
@onready var game_menu: Control = $%GameMenu
|
||||||
@onready var game_menu_panel: Control = $%GameMenuPanel
|
@onready var game_menu_panel: Control = $%GameMenuPanel
|
||||||
@onready var menu_icon_button: Button = $%MenuIconButton
|
@onready var menu_icon_button: Button = $%MenuIconButton
|
||||||
@@ -89,6 +88,8 @@ func _on_weather_row_on_option_changed(data: String) -> void:
|
|||||||
pick_random_weather()
|
pick_random_weather()
|
||||||
_:
|
_:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
AchievementManager.is_unlocked("ACH_CHANGE_METEO")
|
||||||
|
|
||||||
func pick_random_weather() -> void:
|
func pick_random_weather() -> void:
|
||||||
var valid_buttons = []
|
var valid_buttons = []
|
||||||
@@ -166,6 +167,8 @@ func _on_photo_taken_finished() -> void:
|
|||||||
await tween.finished
|
await tween.finished
|
||||||
photo_mode_black_screen.hide()
|
photo_mode_black_screen.hide()
|
||||||
GameState.on_photo_mode_black_screen_disappeared.emit()
|
GameState.on_photo_mode_black_screen_disappeared.emit()
|
||||||
|
StatsManager.add_int("stat_photo_number", 1)
|
||||||
|
StatsManager.store()
|
||||||
|
|
||||||
func hide_ui_for_photo_mode() -> void:
|
func hide_ui_for_photo_mode() -> void:
|
||||||
TweenFX.fade_out(weather_row, 0.25)
|
TweenFX.fade_out(weather_row, 0.25)
|
||||||
|
|||||||
70
core/main_scene_ui/total_stats_display.gd
Normal file
70
core/main_scene_ui/total_stats_display.gd
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
## Updates total elapsed time and train distance labels.
|
||||||
|
class_name TotalStatsDisplay
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
const RAILS_SCRIPT = preload("res://core/biome_generator/rails.gd")
|
||||||
|
const SECONDS_PER_MINUTE: int = 60
|
||||||
|
const MINUTES_PER_HOUR: int = 60
|
||||||
|
const HOURS_PER_DAY: int = 24
|
||||||
|
#DISTANCE_KM_PER_UNIT is taken from rails.gd constant
|
||||||
|
|
||||||
|
@export var time_label_path: NodePath
|
||||||
|
@export var distance_label_path: NodePath
|
||||||
|
@export var rail_path: NodePath
|
||||||
|
|
||||||
|
var _elapsed_seconds: float = 0.0
|
||||||
|
var _total_distance_km: float = 0.0
|
||||||
|
var _last_train_progress: float = -1.0
|
||||||
|
|
||||||
|
@onready var _time_label: Label = get_node_or_null(time_label_path) as Label
|
||||||
|
@onready var _distance_label: Label = get_node_or_null(distance_label_path) as Label
|
||||||
|
@onready var _rail_path: Path3D = get_node_or_null(rail_path) as Path3D
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
_update_time_label()
|
||||||
|
_update_distance_label()
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
_elapsed_seconds += delta
|
||||||
|
_update_total_distance()
|
||||||
|
_update_time_label()
|
||||||
|
_update_distance_label()
|
||||||
|
|
||||||
|
|
||||||
|
func _update_total_distance() -> void:
|
||||||
|
if _rail_path == null or _rail_path.curve == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
var current_train_progress: float = float(_rail_path.get("train_progress"))
|
||||||
|
if _last_train_progress < 0.0:
|
||||||
|
_last_train_progress = current_train_progress
|
||||||
|
return
|
||||||
|
|
||||||
|
var total_length: float = _rail_path.curve.get_baked_length()
|
||||||
|
if total_length <= 0.0:
|
||||||
|
return
|
||||||
|
|
||||||
|
var progress_delta: float = absf(current_train_progress - _last_train_progress)
|
||||||
|
var wrapped_progress_delta: float = minf(progress_delta, total_length - progress_delta)
|
||||||
|
_total_distance_km += wrapped_progress_delta * RAILS_SCRIPT.DISTANCE_KM_PER_UNIT
|
||||||
|
_last_train_progress = current_train_progress
|
||||||
|
|
||||||
|
|
||||||
|
func _update_time_label() -> void:
|
||||||
|
if _time_label == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
var total_minutes: int = int(floor(_elapsed_seconds / SECONDS_PER_MINUTE))
|
||||||
|
var days: int = floori(float(total_minutes) / float(MINUTES_PER_HOUR * HOURS_PER_DAY))
|
||||||
|
var hours: int = floori(float(total_minutes) / float(MINUTES_PER_HOUR)) % HOURS_PER_DAY
|
||||||
|
var minutes: int = total_minutes % MINUTES_PER_HOUR
|
||||||
|
_time_label.text = "Time %dd %02dh %02dm" % [days, hours, minutes]
|
||||||
|
|
||||||
|
|
||||||
|
func _update_distance_label() -> void:
|
||||||
|
if _distance_label == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
_distance_label.text = "Distance %.1f km" % _total_distance_km
|
||||||
1
core/main_scene_ui/total_stats_display.gd.uid
Normal file
1
core/main_scene_ui/total_stats_display.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://c2usnexa5x7pg
|
||||||
@@ -4,23 +4,22 @@ extends Node
|
|||||||
#if you have an error setting achievements or stats in debug mode remember to open your steam client
|
#if you have an error setting achievements or stats in debug mode remember to open your steam client
|
||||||
#with jmp games account or another account who bought this game. If error persist try to clos and reopen steam client.
|
#with jmp games account or another account who bought this game. If error persist try to clos and reopen steam client.
|
||||||
const KNOWN := [
|
const KNOWN := [
|
||||||
"ACH_DISTANCE_100",
|
"ACH_CHANGE_METEO",
|
||||||
"ACH_DISTANCE_200",
|
"ACH_CHANGE_TRAIN_COLOR",
|
||||||
"ACH_10_PHOTOS",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
#how it works:
|
#how it works:
|
||||||
#func _on_player_won() -> void:
|
#func _on_player_won() -> void:
|
||||||
# Achievements.unlock("ACH_DISTANCE_100") #unlock the achievement at first win
|
# AchievementManager.unlock("ACH_DISTANCE_100") #unlock the achievement at first win
|
||||||
|
|
||||||
#func _on_match_finished(coins_collected: int) -> void:
|
#func _on_match_finished(coins_collected: int) -> void:
|
||||||
#update stats
|
#update stats
|
||||||
#...
|
#...
|
||||||
#check thresholds and unlock achievements
|
#check thresholds and unlock achievements
|
||||||
# if Stats.get_int("stat_distance_km") >= 100:
|
# if StatsManager.get_int("stat_distance_km") >= 100:
|
||||||
# Achievements.unlock("ACH_DISTANCE_100")
|
# AchievementManager.unlock("ACH_DISTANCE_100")
|
||||||
# if Stats.get_int("stat_distance_km") >= 200:
|
# if StatsManager.get_int("stat_distance_km") >= 200:
|
||||||
# Achievements.unlock("ACH_DISTANCE_200")
|
# AchievementManager.unlock("ACH_DISTANCE_200")
|
||||||
|
|
||||||
signal unlocked(api_name: String)
|
signal unlocked(api_name: String)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ extends Node
|
|||||||
#if you have an error setting achievements or stats in debug mode remember to open your steam client
|
#if you have an error setting achievements or stats in debug mode remember to open your steam client
|
||||||
#with jmp games account or another account who bought this game. If error persist try to clos and reopen steam client.
|
#with jmp games account or another account who bought this game. If error persist try to clos and reopen steam client.
|
||||||
const KNOWN := [
|
const KNOWN := [
|
||||||
"stat_games_played",
|
"stat_time_played",
|
||||||
"stat_distance_km",
|
"stat_distance_km",
|
||||||
"stat_stop_number",
|
"stat_stop_number",
|
||||||
"stat_photo_number",
|
"stat_photo_number",
|
||||||
@@ -16,11 +16,11 @@ const KNOWN := [
|
|||||||
|
|
||||||
#how it works:
|
#how it works:
|
||||||
#func _on_match_finished(score: int) -> void:
|
#func _on_match_finished(score: int) -> void:
|
||||||
# Stats.add_int("stat_games_played", 1)
|
# StatsManager.add_int("stat_time_played", 1)
|
||||||
# Stats.set_int("stat_total_score", Stats.get_int("stat_total_score") + score)
|
# StatsManager.set_int("stat_total_score", StatsManager.get_int("stat_total_score") + score)
|
||||||
# Stats.store() #only one push at the end of the game
|
# StatsManager.store() #only one push at the end of the game
|
||||||
# if Stats.get_int("stat_games_played") >= 10:
|
# if StatsManager.get_int("stat_time_played") >= 10:
|
||||||
# Achievements.unlock("ACH_PLAY_10_GAMES") #it call storeStats()
|
# AchievementManager.unlock("ACH_PLAY_10_HOURS") #it call storeStats()
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -64,8 +64,8 @@ func store() -> void:
|
|||||||
|
|
||||||
#Development only: reset stats
|
#Development only: reset stats
|
||||||
func reset_all(include_achievements: bool = false) -> void:
|
func reset_all(include_achievements: bool = false) -> void:
|
||||||
Steam.resetAllStats(include_achievements)
|
if !Steam.resetAllStats(include_achievements):
|
||||||
Steam.storeStats()
|
push_error("resetAllStats failed")
|
||||||
|
|
||||||
func _on_stats_stored(_game: int, result: int) -> void:
|
func _on_stats_stored(_game: int, result: int) -> void:
|
||||||
if !result:
|
if !result:
|
||||||
|
|||||||
57
core/transition.gdshader
Normal file
57
core/transition.gdshader
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
shader_type canvas_item;
|
||||||
|
|
||||||
|
uniform vec4 base_color : source_color;
|
||||||
|
uniform vec2 node_resolution;
|
||||||
|
|
||||||
|
uniform float factor : hint_range(0.0, 1.0, 0.01) = 0.54;
|
||||||
|
uniform float width = 0.4;
|
||||||
|
|
||||||
|
group_uniforms gradient;
|
||||||
|
uniform sampler2D gradient_texture;
|
||||||
|
uniform bool gradient_fixed = false;
|
||||||
|
|
||||||
|
group_uniforms shape;
|
||||||
|
uniform sampler2D shape_texture;
|
||||||
|
uniform float shape_tiling = 32.0;
|
||||||
|
uniform float shape_rotation = 0.0;
|
||||||
|
uniform vec2 shape_scroll = vec2(0.0);
|
||||||
|
uniform float shape_feathering : hint_range(0.0, 1.0, 0.01) = 0.00;
|
||||||
|
uniform float shape_treshold : hint_range(0.0, 2.0, 0.01) = 1.0;
|
||||||
|
|
||||||
|
float gradient(vec2 uv, vec2 fixed_uv, bool fixed){
|
||||||
|
float value = 0.0;
|
||||||
|
if(fixed){
|
||||||
|
value = texture(gradient_texture, fixed_uv).r;
|
||||||
|
} else {
|
||||||
|
value = texture(gradient_texture, uv).r;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 rotate(vec2 uv, vec2 pivot, float angle)
|
||||||
|
{
|
||||||
|
mat2 rotation = mat2(vec2(sin(angle), -cos(angle)),
|
||||||
|
vec2(cos(angle), sin(angle)));
|
||||||
|
uv -= pivot;
|
||||||
|
uv = uv * rotation;
|
||||||
|
uv += pivot;
|
||||||
|
return uv;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
float progress = mix(-width, 1.0, factor);
|
||||||
|
float aspect = node_resolution.y / node_resolution.x;
|
||||||
|
|
||||||
|
vec2 aspect_uv = ((UV-vec2(0.0,0.5)) * vec2(1.0, aspect))+vec2(0.0,0.5);
|
||||||
|
|
||||||
|
float value = clamp((gradient(UV, aspect_uv, gradient_fixed) - progress) / (width), 0.0, 1.0);
|
||||||
|
|
||||||
|
vec2 tiled_uv = rotate(mod((aspect_uv + vec2(TIME)*shape_scroll) * shape_tiling, 1.0), vec2(0.5), radians(shape_rotation));
|
||||||
|
float shape_value = 1.0 - texture(shape_texture, tiled_uv).r;
|
||||||
|
|
||||||
|
shape_value = mix(shape_feathering * 0.5, 1.0 - shape_feathering * 0.5, shape_value);
|
||||||
|
float shaped_gradient = smoothstep(value - (shape_feathering * 0.5), value + (shape_feathering * 0.5), shape_treshold - shape_value);
|
||||||
|
|
||||||
|
COLOR.rgb = base_color.rgb;
|
||||||
|
COLOR.a = shaped_gradient;
|
||||||
|
}
|
||||||
1
core/transition.gdshader.uid
Normal file
1
core/transition.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://ovrd5ydp8p0q
|
||||||
@@ -43,3 +43,7 @@ signal day_time_changed(value: float, time_string: String)
|
|||||||
signal time_option_item_changed(index: int)
|
signal time_option_item_changed(index: int)
|
||||||
@warning_ignore("unused_signal")
|
@warning_ignore("unused_signal")
|
||||||
signal day_time_option_changed(index: int)
|
signal day_time_option_changed(index: int)
|
||||||
|
|
||||||
|
#train signals
|
||||||
|
@warning_ignore("unused_signal")
|
||||||
|
signal toot_toot()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
extends Node3D
|
extends Node3D
|
||||||
|
|
||||||
func _input(event):
|
#func _input(event):
|
||||||
if event is InputEventKey and event.pressed:
|
#if event is InputEventKey and event.pressed:
|
||||||
if event.keycode == KEY_ESCAPE:
|
#if event.keycode == KEY_ESCAPE:
|
||||||
get_tree().quit()
|
#get_tree().quit()
|
||||||
|
|||||||
@@ -107,3 +107,9 @@ func _on_fog_toggled(toggled_on: bool) -> void:
|
|||||||
|
|
||||||
func _on_update_rails_pressed() -> void:
|
func _on_update_rails_pressed() -> void:
|
||||||
UIEvents.update_rail_chunks.emit()
|
UIEvents.update_rail_chunks.emit()
|
||||||
|
|
||||||
|
func _on_toot_toot_pressed() -> void:
|
||||||
|
UIEvents.toot_toot.emit()
|
||||||
|
|
||||||
|
func _on_reset_stats_ach_pressed() -> void:
|
||||||
|
StatsManager.reset_all(true)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
extends Node3D
|
extends Node3D
|
||||||
|
|
||||||
func _input(event):
|
#func _input(event):
|
||||||
if event is InputEventKey and event.pressed:
|
#if event is InputEventKey and event.pressed:
|
||||||
if event.keycode == KEY_ESCAPE:
|
#if event.keycode == KEY_ESCAPE:
|
||||||
get_tree().quit()
|
#get_tree().quit()
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://bei7fscn77p1p" path="res://core/main_scene_ui/main_scene_ui.tscn" id="49_exdk1"]
|
[ext_resource type="PackedScene" uid="uid://bei7fscn77p1p" path="res://core/main_scene_ui/main_scene_ui.tscn" id="49_exdk1"]
|
||||||
[ext_resource type="PackedScene" uid="uid://vni5kjalum6d" path="res://core/photo_mode/runtime/photo_mode_controller.tscn" id="50_57hhv"]
|
[ext_resource type="PackedScene" uid="uid://vni5kjalum6d" path="res://core/photo_mode/runtime/photo_mode_controller.tscn" id="50_57hhv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bujym3ai10i7q" path="res://tgcc/chunk/countryside/scene/tea/chunk_country_tea_corner_01.tscn" id="51_lxncq"]
|
[ext_resource type="PackedScene" uid="uid://bujym3ai10i7q" path="res://tgcc/chunk/countryside/scene/tea/chunk_country_tea_corner_01.tscn" id="51_lxncq"]
|
||||||
|
[ext_resource type="Script" uid="uid://c2usnexa5x7pg" path="res://core/main_scene_ui/total_stats_display.gd" id="51_totals"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bdfosig4g14vt" path="res://tgcc/chunk/countryside/scene/tea/chunk_country_tea_corner_02.tscn" id="52_317hq"]
|
[ext_resource type="PackedScene" uid="uid://bdfosig4g14vt" path="res://tgcc/chunk/countryside/scene/tea/chunk_country_tea_corner_02.tscn" id="52_317hq"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ffblnqib7fry" path="res://tgcc/chunk/countryside/scene/tea/chunk_country_tea_cross_3_01.tscn" id="53_0ur37"]
|
[ext_resource type="PackedScene" uid="uid://ffblnqib7fry" path="res://tgcc/chunk/countryside/scene/tea/chunk_country_tea_cross_3_01.tscn" id="53_0ur37"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b785qpoxbrovj" path="res://tgcc/chunk/countryside/scene/tea/chunk_country_tea_cross_3_02.tscn" id="54_vbb0s"]
|
[ext_resource type="PackedScene" uid="uid://b785qpoxbrovj" path="res://tgcc/chunk/countryside/scene/tea/chunk_country_tea_cross_3_02.tscn" id="54_vbb0s"]
|
||||||
@@ -218,6 +219,11 @@ transform = Transform3D(0.57785755, -0.57709646, 0.5770964, 0, 0.7071067, 0.7071
|
|||||||
rotation_target = NodePath("../pivot")
|
rotation_target = NodePath("../pivot")
|
||||||
iso_camera = NodePath("../camera_iso")
|
iso_camera = NodePath("../camera_iso")
|
||||||
|
|
||||||
|
[node name="MainSceneUi" parent="cameras" unique_id=1359391222 instance=ExtResource("49_exdk1")]
|
||||||
|
offset_left = 3.0
|
||||||
|
offset_right = 3.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="DayNight" parent="." unique_id=1611939731 node_paths=PackedStringArray("camera_pivot") instance=ExtResource("36_qwsp8")]
|
[node name="DayNight" parent="." unique_id=1611939731 node_paths=PackedStringArray("camera_pivot") instance=ExtResource("36_qwsp8")]
|
||||||
camera_pivot = NodePath("../cameras")
|
camera_pivot = NodePath("../cameras")
|
||||||
thunder_sounds = Array[AudioStream]([SubResource("AudioStreamMP3_ra0ar"), SubResource("AudioStreamMP3_j8mxr"), ExtResource("37_pdfkp"), ExtResource("38_fpbvh"), ExtResource("39_hxtdl")])
|
thunder_sounds = Array[AudioStream]([SubResource("AudioStreamMP3_ra0ar"), SubResource("AudioStreamMP3_j8mxr"), ExtResource("37_pdfkp"), ExtResource("38_fpbvh"), ExtResource("39_hxtdl")])
|
||||||
@@ -262,7 +268,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -91.191925, 0, 539.03174)
|
|||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -312.19193, 0, 349.03174)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -312.19193, 0, 349.03174)
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="." unique_id=630650980]
|
[node name="Control" type="Control" parent="." unique_id=630650980]
|
||||||
visible = false
|
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_right = 40.0
|
offset_right = 40.0
|
||||||
@@ -348,6 +353,29 @@ theme_override_colors/font_hover_pressed_color = Color(1, 1, 1, 1)
|
|||||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||||
text = "Storm"
|
text = "Storm"
|
||||||
|
|
||||||
|
[node name="TotalDistance" type="Label" parent="Control" unique_id=1735753299]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 277.0
|
||||||
|
offset_top = 31.0
|
||||||
|
offset_right = 611.0
|
||||||
|
offset_bottom = 54.0
|
||||||
|
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||||
|
text = "Distance 0 km"
|
||||||
|
|
||||||
|
[node name="TotalTime" type="Label" parent="Control" unique_id=1065776479]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 276.0
|
||||||
|
offset_top = 13.0
|
||||||
|
offset_right = 610.0
|
||||||
|
offset_bottom = 36.0
|
||||||
|
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||||
|
text = "Time 00:00"
|
||||||
|
|
||||||
|
[node name="TotalStatsDisplay" type="Node" parent="Control" unique_id=1147065793]
|
||||||
|
script = ExtResource("51_totals")
|
||||||
|
|
||||||
[node name="DayTimeLabel" type="Label" parent="Control" unique_id=1124935856]
|
[node name="DayTimeLabel" type="Label" parent="Control" unique_id=1124935856]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 13.0
|
offset_left = 13.0
|
||||||
@@ -479,6 +507,34 @@ theme_override_colors/font_hover_pressed_color = Color(1, 1, 1, 1)
|
|||||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||||
text = "Fog"
|
text = "Fog"
|
||||||
|
|
||||||
|
[node name="ResetStatsAch" type="Button" parent="Control" unique_id=960673125]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 12.0
|
||||||
|
offset_top = 425.0
|
||||||
|
offset_right = 195.0
|
||||||
|
offset_bottom = 456.0
|
||||||
|
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_colors/font_hover_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_colors/font_hover_pressed_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||||
|
text = "Reset Stats & Ach."
|
||||||
|
|
||||||
|
[node name="TootToot" type="Button" parent="Control" unique_id=2047151132]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 12.0
|
||||||
|
offset_top = 388.0
|
||||||
|
offset_right = 195.0
|
||||||
|
offset_bottom = 419.0
|
||||||
|
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_colors/font_hover_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_colors/font_hover_pressed_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||||
|
text = "Toot Toot"
|
||||||
|
|
||||||
[node name="UpdateRails" type="Button" parent="Control" unique_id=267134156]
|
[node name="UpdateRails" type="Button" parent="Control" unique_id=267134156]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 12.0
|
offset_left = 12.0
|
||||||
@@ -493,9 +549,6 @@ theme_override_colors/font_hover_pressed_color = Color(1, 1, 1, 1)
|
|||||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||||
text = "Update Rails"
|
text = "Update Rails"
|
||||||
|
|
||||||
[node name="MainSceneUi" parent="." unique_id=1359391222 instance=ExtResource("49_exdk1")]
|
|
||||||
mouse_filter = 2
|
|
||||||
|
|
||||||
[connection signal="toggled" from="Control/Snow" to="Control" method="_on_snow_toggled"]
|
[connection signal="toggled" from="Control/Snow" to="Control" method="_on_snow_toggled"]
|
||||||
[connection signal="toggled" from="Control/Rain" to="Control" method="_on_rain_toggled"]
|
[connection signal="toggled" from="Control/Rain" to="Control" method="_on_rain_toggled"]
|
||||||
[connection signal="toggled" from="Control/Wind" to="Control" method="_on_wind_toggled"]
|
[connection signal="toggled" from="Control/Wind" to="Control" method="_on_wind_toggled"]
|
||||||
@@ -510,6 +563,8 @@ mouse_filter = 2
|
|||||||
[connection signal="toggled" from="Control/Shadows" to="Control" method="_on_shadows_toggled"]
|
[connection signal="toggled" from="Control/Shadows" to="Control" method="_on_shadows_toggled"]
|
||||||
[connection signal="pressed" from="Control/RandomWeather" to="Control" method="_on_random_weather_pressed"]
|
[connection signal="pressed" from="Control/RandomWeather" to="Control" method="_on_random_weather_pressed"]
|
||||||
[connection signal="toggled" from="Control/Fog" to="Control" method="_on_fog_toggled"]
|
[connection signal="toggled" from="Control/Fog" to="Control" method="_on_fog_toggled"]
|
||||||
|
[connection signal="pressed" from="Control/ResetStatsAch" to="Control" method="_on_reset_stats_ach_pressed"]
|
||||||
|
[connection signal="pressed" from="Control/TootToot" to="Control" method="_on_toot_toot_pressed"]
|
||||||
[connection signal="pressed" from="Control/UpdateRails" to="Control" method="_on_update_rails_pressed"]
|
[connection signal="pressed" from="Control/UpdateRails" to="Control" method="_on_update_rails_pressed"]
|
||||||
|
|
||||||
[editable path="cameras"]
|
[editable path="cameras"]
|
||||||
|
|||||||
551
tgcc/main_scene.tscn4188253392.tmp
Normal file
551
tgcc/main_scene.tscn4188253392.tmp
Normal file
File diff suppressed because one or more lines are too long
BIN
tgcc/train/sounds/train_whistle.mp3
Normal file
BIN
tgcc/train/sounds/train_whistle.mp3
Normal file
Binary file not shown.
19
tgcc/train/sounds/train_whistle.mp3.import
Normal file
19
tgcc/train/sounds/train_whistle.mp3.import
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="mp3"
|
||||||
|
type="AudioStreamMP3"
|
||||||
|
uid="uid://dc6si4i1wgtg1"
|
||||||
|
path="res://.godot/imported/train_whistle.mp3-7c9ba844b982f1e2dc8f87df905de652.mp3str"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://tgcc/train/sounds/train_whistle.mp3"
|
||||||
|
dest_files=["res://.godot/imported/train_whistle.mp3-7c9ba844b982f1e2dc8f87df905de652.mp3str"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
||||||
BIN
tgcc/train/sounds/train_whistle2.mp3
Normal file
BIN
tgcc/train/sounds/train_whistle2.mp3
Normal file
Binary file not shown.
19
tgcc/train/sounds/train_whistle2.mp3.import
Normal file
19
tgcc/train/sounds/train_whistle2.mp3.import
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="mp3"
|
||||||
|
type="AudioStreamMP3"
|
||||||
|
uid="uid://cr7evvbfp33ra"
|
||||||
|
path="res://.godot/imported/train_whistle2.mp3-fa64a19fd0b0cdce9722553ae5dff242.mp3str"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://tgcc/train/sounds/train_whistle2.mp3"
|
||||||
|
dest_files=["res://.godot/imported/train_whistle2.mp3-fa64a19fd0b0cdce9722553ae5dff242.mp3str"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
||||||
46
tgcc/train/train.gd
Normal file
46
tgcc/train/train.gd
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
extends Node3D
|
||||||
|
|
||||||
|
#const TRAIN_WHISTLE_STREAM: AudioStream = preload("res://tgcc/train/sounds/train_whistle.mp3")
|
||||||
|
const TRAIN_WHISTLE_STREAM: AudioStream = preload("res://tgcc/train/sounds/train_whistle2.mp3")
|
||||||
|
|
||||||
|
@export_group("Whistle")
|
||||||
|
@export var whistle_volume_db: float = 1.0
|
||||||
|
@export var whistle_unit_size: float = 90.0
|
||||||
|
@export var whistle_max_distance: float = 1200.0
|
||||||
|
|
||||||
|
var _whistle_player: AudioStreamPlayer3D
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
_create_whistle_player()
|
||||||
|
|
||||||
|
if not UIEvents.toot_toot.is_connected(_on_toot_toot):
|
||||||
|
UIEvents.toot_toot.connect(_on_toot_toot)
|
||||||
|
|
||||||
|
|
||||||
|
func _exit_tree() -> void:
|
||||||
|
if UIEvents.toot_toot.is_connected(_on_toot_toot):
|
||||||
|
UIEvents.toot_toot.disconnect(_on_toot_toot)
|
||||||
|
|
||||||
|
|
||||||
|
func _create_whistle_player() -> void:
|
||||||
|
_whistle_player = AudioStreamPlayer3D.new()
|
||||||
|
_whistle_player.name = "TrainWhistlePlayer"
|
||||||
|
_whistle_player.bus = &"SFX"
|
||||||
|
_whistle_player.volume_db = whistle_volume_db
|
||||||
|
_whistle_player.unit_size = whistle_unit_size
|
||||||
|
_whistle_player.max_distance = whistle_max_distance
|
||||||
|
_whistle_player.stream = TRAIN_WHISTLE_STREAM
|
||||||
|
add_child(_whistle_player)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_toot_toot() -> void:
|
||||||
|
if _whistle_player == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
print("stat_toottoot_number")
|
||||||
|
StatsManager.add_int("stat_toottoot_number", 1)
|
||||||
|
StatsManager.store()
|
||||||
|
|
||||||
|
_whistle_player.stop()
|
||||||
|
_whistle_player.play()
|
||||||
1
tgcc/train/train.gd.uid
Normal file
1
tgcc/train/train.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://c34qgl2afyhse
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
[ext_resource type="Material" uid="uid://o31kp0jm07q3" path="res://tgcc/chunk/material/rocks.tres" id="5_pj7tp"]
|
[ext_resource type="Material" uid="uid://o31kp0jm07q3" path="res://tgcc/chunk/material/rocks.tres" id="5_pj7tp"]
|
||||||
[ext_resource type="Material" uid="uid://bsote67noubj2" path="res://tgcc/train/Color1_train.tres" id="7_sgpgi"]
|
[ext_resource type="Material" uid="uid://bsote67noubj2" path="res://tgcc/train/Color1_train.tres" id="7_sgpgi"]
|
||||||
[ext_resource type="Shader" uid="uid://d0ch5ofrgf7y6" path="res://core/daynight/trunk_shader.gdshader" id="8_eke0t"]
|
[ext_resource type="Shader" uid="uid://d0ch5ofrgf7y6" path="res://core/daynight/trunk_shader.gdshader" id="8_eke0t"]
|
||||||
[ext_resource type="Script" uid="uid://5frq4qrokiy2" path="res://tgcc/train/train_glass_emission.gd" id="9_4qk3b"]
|
[ext_resource type="Script" path="res://tgcc/train/train.gd" id="9_4qk3b"]
|
||||||
[ext_resource type="Texture2D" uid="uid://j4m5wsf4magb" path="res://tgcc/chunk/material/decal/vending_decal.png" id="9_eke0t"]
|
[ext_resource type="Texture2D" uid="uid://j4m5wsf4magb" path="res://tgcc/chunk/material/decal/vending_decal.png" id="9_eke0t"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_p4ai0"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_p4ai0"]
|
||||||
|
|||||||
Reference in New Issue
Block a user