Compare commits
6 Commits
whitleands
...
8be3609deb
| Author | SHA1 | Date | |
|---|---|---|---|
| 8be3609deb | |||
| 7a6f94ed07 | |||
| 5224593c11 | |||
| 35d102fbc4 | |||
| 97bbca95e8 | |||
| 2b1370bd40 |
@@ -15,8 +15,8 @@ var _enable_state_machine: bool = true
|
|||||||
@export var anim_player: AnimationPlayer
|
@export var anim_player: AnimationPlayer
|
||||||
|
|
||||||
@export_group("Entities")
|
@export_group("Entities")
|
||||||
enum EntityType { HUMANOID, ANIMAL }
|
enum EntityType { FARMER, CITIZEN_WALKER, CITIZEN_SITTER, CAT, CROW, FOX, GOAT, RACOON, WAGYU }
|
||||||
@export var entity_type: EntityType = EntityType.HUMANOID
|
@export var entity_type: EntityType = EntityType.FARMER
|
||||||
@export var entity_name: String = ""
|
@export var entity_name: String = ""
|
||||||
@export var allowed_biomes: Array[String] = []
|
@export var allowed_biomes: Array[String] = []
|
||||||
@export_range(0.0, 100.0, 0.1) var spawn_uniqueness: float = 1.0
|
@export_range(0.0, 100.0, 0.1) var spawn_uniqueness: float = 1.0
|
||||||
@@ -32,7 +32,8 @@ func _ready() -> void:
|
|||||||
toggle_enable_state_machine()
|
toggle_enable_state_machine()
|
||||||
|
|
||||||
func toggle_enable_state_machine() -> void:
|
func toggle_enable_state_machine() -> void:
|
||||||
state_machine.enable = _enable_state_machine
|
if state_machine:
|
||||||
|
state_machine.enable = _enable_state_machine
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if !_enable_state_machine:
|
if !_enable_state_machine:
|
||||||
|
|||||||
38
core/ai/agents/cat/ai_cat.gd
Normal file
38
core/ai/agents/cat/ai_cat.gd
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
extends AIBase
|
||||||
|
|
||||||
|
class_name AICat
|
||||||
|
|
||||||
|
@export_group("Cat Colors")
|
||||||
|
@export var mesh: MeshInstance3D
|
||||||
|
@export var fur_colors: Array[Color] = []
|
||||||
|
@export var eye_colors: Array[Color] = []
|
||||||
|
|
||||||
|
@export var fur_material_index: int = 0
|
||||||
|
@export var eye_material_index: int = 1
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
super._ready()
|
||||||
|
_apply_random_color()
|
||||||
|
|
||||||
|
func _apply_random_color() -> void:
|
||||||
|
if fur_colors.is_empty() or eye_colors.is_empty():
|
||||||
|
return
|
||||||
|
|
||||||
|
if not mesh or not mesh.mesh:
|
||||||
|
return
|
||||||
|
|
||||||
|
var max_index = min(fur_colors.size(), eye_colors.size())
|
||||||
|
var random_idx = randi() % max_index
|
||||||
|
|
||||||
|
_override_material_color(mesh, fur_material_index, fur_colors[random_idx])
|
||||||
|
_override_material_color(mesh, eye_material_index, eye_colors[random_idx])
|
||||||
|
|
||||||
|
func _override_material_color(mesh_node: MeshInstance3D, surface_idx: int, color: Color) -> void:
|
||||||
|
if surface_idx < 0 or surface_idx >= mesh_node.mesh.get_surface_count():
|
||||||
|
return
|
||||||
|
|
||||||
|
var mat = mesh_node.mesh.surface_get_material(surface_idx)
|
||||||
|
if mat and mat is StandardMaterial3D:
|
||||||
|
var new_mat = mat.duplicate() as StandardMaterial3D
|
||||||
|
new_mat.albedo_color = color
|
||||||
|
mesh_node.set_surface_override_material(surface_idx, new_mat)
|
||||||
1
core/ai/agents/cat/ai_cat.gd.uid
Normal file
1
core/ai/agents/cat/ai_cat.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cx67xas1hxv3x
|
||||||
@@ -2,12 +2,20 @@
|
|||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_85o24"]
|
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_85o24"]
|
||||||
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="2_6mu8r"]
|
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="2_6mu8r"]
|
||||||
|
[ext_resource type="Script" uid="uid://cx67xas1hxv3x" path="res://core/ai/agents/cat/ai_cat.gd" id="2_cat_script"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c5rccx22gs6jt" path="res://core/ai/agents/cat/Cat_rig.fbx" id="2_rohxe"]
|
[ext_resource type="PackedScene" uid="uid://c5rccx22gs6jt" path="res://core/ai/agents/cat/Cat_rig.fbx" id="2_rohxe"]
|
||||||
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_0jm3k"]
|
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_0jm3k"]
|
||||||
|
[ext_resource type="Script" uid="uid://dty1p02kqviwf" path="res://core/ai/framework/sit_state.gd" id="3_scd7t"]
|
||||||
|
|
||||||
[node name="AiCat" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_85o24")]
|
[node name="AiCat" unique_id=1228675528 node_paths=PackedStringArray("mesh", "anim_player") instance=ExtResource("1_85o24")]
|
||||||
|
script = ExtResource("2_cat_script")
|
||||||
|
mesh = NodePath("Cat_rig/Rig_Cat/Skeleton3D/Cat")
|
||||||
|
fur_colors = Array[Color]([])
|
||||||
|
eye_colors = Array[Color]([])
|
||||||
|
fur_material_index = 0
|
||||||
|
eye_material_index = 1
|
||||||
anim_player = NodePath("Cat_rig/AnimationPlayer")
|
anim_player = NodePath("Cat_rig/AnimationPlayer")
|
||||||
entity_type = 1
|
entity_type = 3
|
||||||
entity_name = "Cat"
|
entity_name = "Cat"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
@@ -17,9 +25,16 @@ initial_state = NodePath("IdleState")
|
|||||||
script = ExtResource("2_6mu8r")
|
script = ExtResource("2_6mu8r")
|
||||||
state_id = &"idle"
|
state_id = &"idle"
|
||||||
next_state_id = &"patrol"
|
next_state_id = &"patrol"
|
||||||
|
random_next_state_ids = Array[StringName]([&"patrol", &"sit"])
|
||||||
animation_name = "Cat_Idle"
|
animation_name = "Cat_Idle"
|
||||||
|
|
||||||
[node name="PatrolState" type="Node" parent="StateMachine" index="1" unique_id=1861645340]
|
[node name="SitState" type="Node" parent="StateMachine" index="1" unique_id=860354787]
|
||||||
|
script = ExtResource("3_scd7t")
|
||||||
|
state_id = &"sit"
|
||||||
|
next_state_id = &"idle"
|
||||||
|
animation_name = "Cat_Sit"
|
||||||
|
|
||||||
|
[node name="PatrolState" type="Node" parent="StateMachine" index="2" unique_id=1861645340]
|
||||||
script = ExtResource("3_0jm3k")
|
script = ExtResource("3_0jm3k")
|
||||||
state_id = &"patrol"
|
state_id = &"patrol"
|
||||||
next_state_id = &"idle"
|
next_state_id = &"idle"
|
||||||
@@ -28,7 +43,7 @@ exit_on_action_finished = true
|
|||||||
|
|
||||||
[node name="Cat_rig" parent="." index="3" unique_id=1332997618 instance=ExtResource("2_rohxe")]
|
[node name="Cat_rig" parent="." index="3" unique_id=1332997618 instance=ExtResource("2_rohxe")]
|
||||||
|
|
||||||
[node name="Skeleton3D" parent="Cat_rig/Rig_Cat" parent_id_path=PackedInt32Array(1332997618, 1292226211) index="0" unique_id=807490174]
|
[node name="Skeleton3D" parent="Cat_rig/Rig_Cat" parent_id_path=PackedInt32Array(1332997618, 656824407) index="0" unique_id=1952223098]
|
||||||
bones/1/position = Vector3(1.6719584e-08, 0.23547882, 0.34218493)
|
bones/1/position = Vector3(1.6719584e-08, 0.23547882, 0.34218493)
|
||||||
bones/1/rotation = Quaternion(0.12769094, -0.6954821, -0.12769029, 0.69548184)
|
bones/1/rotation = Quaternion(0.12769094, -0.6954821, -0.12769029, 0.69548184)
|
||||||
bones/2/rotation = Quaternion(-1.5819447e-07, -1.9079575e-07, -0.5904159, 0.8070992)
|
bones/2/rotation = Quaternion(-1.5819447e-07, -1.9079575e-07, -0.5904159, 0.8070992)
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
[node name="AiCrow" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_tx3nx")]
|
[node name="AiCrow" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_tx3nx")]
|
||||||
anim_player = NodePath("Crow_rig/AnimationPlayer")
|
anim_player = NodePath("Crow_rig/AnimationPlayer")
|
||||||
|
entity_type = 4
|
||||||
|
entity_name = "Crow"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
initial_state = NodePath("WaitTrainState")
|
initial_state = NodePath("WaitTrainState")
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
[node name="AiFox" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_m3efo")]
|
[node name="AiFox" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_m3efo")]
|
||||||
anim_player = NodePath("Fox_rig/AnimationPlayer")
|
anim_player = NodePath("Fox_rig/AnimationPlayer")
|
||||||
|
entity_type = 5
|
||||||
|
entity_name = "Fox"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
initial_state = NodePath("IdleState")
|
initial_state = NodePath("IdleState")
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
[node name="AiGoat" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_f7hhh")]
|
[node name="AiGoat" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_f7hhh")]
|
||||||
anim_player = NodePath("Goat_rig/AnimationPlayer")
|
anim_player = NodePath("Goat_rig/AnimationPlayer")
|
||||||
|
entity_type = 6
|
||||||
|
entity_name = "Goat"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
initial_state = NodePath("IdleState")
|
initial_state = NodePath("IdleState")
|
||||||
@@ -26,7 +28,7 @@ exit_on_action_finished = true
|
|||||||
|
|
||||||
[node name="Goat_rig" parent="." index="3" unique_id=1336829719 instance=ExtResource("2_oxwbf")]
|
[node name="Goat_rig" parent="." index="3" unique_id=1336829719 instance=ExtResource("2_oxwbf")]
|
||||||
|
|
||||||
[node name="Skeleton3D" parent="Goat_rig/Rig_Goat" parent_id_path=PackedInt32Array(1336829719, 1896192446) index="0" unique_id=1573667924]
|
[node name="Skeleton3D" parent="Goat_rig/Rig_Goat" parent_id_path=PackedInt32Array(1336829719, 123281310) index="0" unique_id=1526518923]
|
||||||
bones/1/position = Vector3(-8.352713e-09, 0.36986786, 0.8951362)
|
bones/1/position = Vector3(-8.352713e-09, 0.36986786, 0.8951362)
|
||||||
bones/1/rotation = Quaternion(0.1276911, -0.695482, -0.12769035, 0.69548184)
|
bones/1/rotation = Quaternion(0.1276911, -0.695482, -0.12769035, 0.69548184)
|
||||||
bones/2/rotation = Quaternion(-8.7811394e-08, -9.458198e-08, -0.5904155, 0.80709946)
|
bones/2/rotation = Quaternion(-8.7811394e-08, -9.458198e-08, -0.5904155, 0.80709946)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://bdqeshcwwnyc4" path="res://core/ai/agents/human/ai_citizen.tscn" id="1_cduuu"]
|
[ext_resource type="PackedScene" uid="uid://bdqeshcwwnyc4" path="res://core/ai/agents/human/ai_citizen.tscn" id="1_cduuu"]
|
||||||
|
|
||||||
[node name="AiCitizenSitter" unique_id=1228675528 instance=ExtResource("1_cduuu")]
|
[node name="AiCitizenSitter" unique_id=1228675528 instance=ExtResource("1_cduuu")]
|
||||||
|
entity_type = 2
|
||||||
entity_name = "CitizenSitter"
|
entity_name = "CitizenSitter"
|
||||||
|
|
||||||
[node name="Skeleton3D" parent="BaseMesh/BaseMesh" parent_id_path=PackedInt32Array(1846171523, 1142246531) index="0" unique_id=928995817]
|
[node name="Skeleton3D" parent="BaseMesh/BaseMesh" parent_id_path=PackedInt32Array(1846171523, 1142246531) index="0" unique_id=928995817]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_8d0tj"]
|
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_8d0tj"]
|
||||||
|
|
||||||
[node name="AiCitizenWalker" unique_id=1228675528 instance=ExtResource("1_dms8s")]
|
[node name="AiCitizenWalker" unique_id=1228675528 instance=ExtResource("1_dms8s")]
|
||||||
|
entity_type = 1
|
||||||
entity_name = "CitizenWalker"
|
entity_name = "CitizenWalker"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="4_2oda6"]
|
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="4_2oda6"]
|
||||||
|
|
||||||
[node name="AiFarmer" unique_id=1228675528 instance=ExtResource("1_l2y7m")]
|
[node name="AiFarmer" unique_id=1228675528 instance=ExtResource("1_l2y7m")]
|
||||||
|
entity_type = 0
|
||||||
entity_name = "Farmer"
|
entity_name = "Farmer"
|
||||||
allowed_biomes = Array[String](["countryside"])
|
allowed_biomes = Array[String](["countryside"])
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
[node name="AiRacoon" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_seif5")]
|
[node name="AiRacoon" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_seif5")]
|
||||||
anim_player = NodePath("Raccoon_rig/AnimationPlayer")
|
anim_player = NodePath("Raccoon_rig/AnimationPlayer")
|
||||||
|
entity_type = 7
|
||||||
|
entity_name = "Racoon"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
initial_state = NodePath("IdleState")
|
initial_state = NodePath("IdleState")
|
||||||
@@ -26,7 +28,7 @@ exit_on_action_finished = true
|
|||||||
|
|
||||||
[node name="Raccoon_rig" parent="." index="3" unique_id=338211330 instance=ExtResource("2_obtl0")]
|
[node name="Raccoon_rig" parent="." index="3" unique_id=338211330 instance=ExtResource("2_obtl0")]
|
||||||
|
|
||||||
[node name="Skeleton3D" parent="Raccoon_rig/Rig_Raccoon" parent_id_path=PackedInt32Array(338211330, 1484615769) index="0" unique_id=689430915]
|
[node name="Skeleton3D" parent="Raccoon_rig/Rig_Raccoon" parent_id_path=PackedInt32Array(338211330, 590893883) index="0" unique_id=1830599374]
|
||||||
bones/1/position = Vector3(2.0224038e-08, 0.20926544, 0.2908604)
|
bones/1/position = Vector3(2.0224038e-08, 0.20926544, 0.2908604)
|
||||||
bones/1/rotation = Quaternion(0.12769087, -0.6954821, -0.12769023, 0.69548184)
|
bones/1/rotation = Quaternion(0.12769087, -0.6954821, -0.12769023, 0.69548184)
|
||||||
bones/1/scale = Vector3(1, 0.99999994, 0.99999994)
|
bones/1/scale = Vector3(1, 0.99999994, 0.99999994)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
[node name="AiWagyu" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_01jto")]
|
[node name="AiWagyu" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_01jto")]
|
||||||
anim_player = NodePath("Wagyu_rig/AnimationPlayer")
|
anim_player = NodePath("Wagyu_rig/AnimationPlayer")
|
||||||
entity_type = 1
|
entity_type = 8
|
||||||
entity_name = "Wagyu"
|
entity_name = "Wagyu"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
|
|||||||
40
core/ai/framework/sit_state.gd
Normal file
40
core/ai/framework/sit_state.gd
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
extends State
|
||||||
|
|
||||||
|
class_name SitState
|
||||||
|
|
||||||
|
var reverse: bool = false
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
reverse = false
|
||||||
|
super.enter()
|
||||||
|
|
||||||
|
if agent.anim_player and not agent.anim_player.animation_finished.is_connected(_on_animation_finished):
|
||||||
|
agent.anim_player.animation_finished.connect(_on_animation_finished)
|
||||||
|
|
||||||
|
if runtime_timer and not runtime_timer.is_stopped():
|
||||||
|
runtime_timer.stop()
|
||||||
|
|
||||||
|
run_animation()
|
||||||
|
|
||||||
|
func exit() -> void:
|
||||||
|
super.exit()
|
||||||
|
if agent.anim_player and agent.anim_player.animation_finished.is_connected(_on_animation_finished):
|
||||||
|
agent.anim_player.animation_finished.disconnect(_on_animation_finished)
|
||||||
|
|
||||||
|
func _on_animation_finished(anim_name: StringName) -> void:
|
||||||
|
if animation_name == anim_name:
|
||||||
|
if not reverse:
|
||||||
|
if min_wait_time > 0:
|
||||||
|
var wait_time := randf_range(min_wait_time, max_wait_time)
|
||||||
|
runtime_timer.start(wait_time)
|
||||||
|
else:
|
||||||
|
_on_timer_timeout()
|
||||||
|
else:
|
||||||
|
transitioned.emit(self, get_next_state())
|
||||||
|
|
||||||
|
func _on_timer_timeout() -> void:
|
||||||
|
reverse = true
|
||||||
|
if agent.anim_player and agent.anim_player.has_animation(animation_name):
|
||||||
|
agent.anim_player.play_backwards(animation_name, blend_time)
|
||||||
|
else:
|
||||||
|
transitioned.emit(self, get_next_state())
|
||||||
1
core/ai/framework/sit_state.gd.uid
Normal file
1
core/ai/framework/sit_state.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dty1p02kqviwf
|
||||||
@@ -4,11 +4,6 @@ extends Node3D
|
|||||||
const CHUNK_TYPE_BIOME: int = 0
|
const CHUNK_TYPE_BIOME: int = 0
|
||||||
const CHUNK_TYPE_STRAIGHT_TRACK: int = 1
|
const CHUNK_TYPE_STRAIGHT_TRACK: int = 1
|
||||||
const CHUNK_TYPE_CURVED_TRACK: int = 2
|
const CHUNK_TYPE_CURVED_TRACK: int = 2
|
||||||
const ENTITY_TYPE_HUMANOID: int = 0
|
|
||||||
const ENTITY_TYPE_ANIMAL: int = 1
|
|
||||||
const ENTITY_SPAWN_ANY: int = 0
|
|
||||||
const ENTITY_SPAWN_HUMANOID_ONLY: int = 1
|
|
||||||
const ENTITY_SPAWN_ANIMAL_ONLY: int = 2
|
|
||||||
|
|
||||||
const CHUNK_GENERATION_FRAME_BUDGET_USEC: int = 1000 #2 ms/frame to generate chunks
|
const CHUNK_GENERATION_FRAME_BUDGET_USEC: int = 1000 #2 ms/frame to generate chunks
|
||||||
const CHUNK_CLEANUP_FRAME_BUDGET_USEC: int = 1000 #1 ms/frame per cleanup
|
const CHUNK_CLEANUP_FRAME_BUDGET_USEC: int = 1000 #1 ms/frame per cleanup
|
||||||
@@ -922,11 +917,10 @@ func _spawn_entities_for_chunk(root: Node, biome_name: String) -> void:
|
|||||||
|
|
||||||
func _get_spawn_point_type_filter(spawn_point: Node) -> int:
|
func _get_spawn_point_type_filter(spawn_point: Node) -> int:
|
||||||
if "allowed_type" in spawn_point:
|
if "allowed_type" in spawn_point:
|
||||||
match spawn_point.allowed_type:
|
if spawn_point.allowed_type == 0:
|
||||||
ENTITY_SPAWN_HUMANOID_ONLY:
|
return -1
|
||||||
return ENTITY_TYPE_HUMANOID
|
else:
|
||||||
ENTITY_SPAWN_ANIMAL_ONLY:
|
return spawn_point.allowed_type - 1
|
||||||
return ENTITY_TYPE_ANIMAL
|
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
func _pick_compatible_entity(biome_name: String, type_filter: int) -> PackedScene:
|
func _pick_compatible_entity(biome_name: String, type_filter: int) -> PackedScene:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
extends Marker3D
|
extends Marker3D
|
||||||
class_name EntitySpawnPoint
|
class_name EntitySpawnPoint
|
||||||
|
|
||||||
enum AllowedType { ANY, HUMANOID_ONLY, ANIMAL_ONLY }
|
enum AllowedType { ANY, FARMER, CITIZEN_WALKER, CITIZEN_SITTER, CAT, CROW, FOX, GOAT, RACOON, WAGYU }
|
||||||
|
|
||||||
@export var allowed_type: AllowedType = AllowedType.ANY
|
@export var allowed_type: AllowedType = AllowedType.ANY
|
||||||
@export_range(0.0, 1.0, 0.01) var spawn_chance: float = 1.0
|
@export_range(0.0, 1.0, 0.01) var spawn_chance: float = 1.0
|
||||||
|
|||||||
@@ -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 DISTANCE_KM_PER_UNIT: float = 0.001
|
const STEAM_DISTANCE_KM_PER_UNIT: float = 1#0.001
|
||||||
|
|
||||||
@export_group("Train")
|
@export_group("Train")
|
||||||
##train speed
|
##train speed
|
||||||
@@ -392,10 +392,17 @@ func train_move(delta: float) -> void:
|
|||||||
|
|
||||||
#Calculate train distance for steam stats
|
#Calculate train distance for steam stats
|
||||||
func _track_steam_distance(distance_units: float) -> void:
|
func _track_steam_distance(distance_units: float) -> void:
|
||||||
if distance_units <= 0.0 or not SteamManager.is_on_steam:
|
if distance_units <= 0.0:
|
||||||
return
|
return
|
||||||
|
|
||||||
_pending_steam_distance_km += distance_units * DISTANCE_KM_PER_UNIT
|
# Always track the global distance in our save file (for UI and persistency)
|
||||||
|
GameState.save_data.total_distance_km += distance_units * STEAM_DISTANCE_KM_PER_UNIT
|
||||||
|
|
||||||
|
# Steam specific logic
|
||||||
|
if not SteamManager.is_on_steam:
|
||||||
|
return
|
||||||
|
|
||||||
|
_pending_steam_distance_km += distance_units * STEAM_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
|
||||||
|
|||||||
BIN
core/game_menu/assets/page_1/barretta_main.png
Normal file
BIN
core/game_menu/assets/page_1/barretta_main.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
40
core/game_menu/assets/page_1/barretta_main.png.import
Normal file
40
core/game_menu/assets/page_1/barretta_main.png.import
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://d2s020wikunuo"
|
||||||
|
path="res://.godot/imported/barretta_main.png-d118ead98672de7a9802ba85eaf04053.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://core/game_menu/assets/page_1/barretta_main.png"
|
||||||
|
dest_files=["res://.godot/imported/barretta_main.png-d118ead98672de7a9802ba85eaf04053.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
BIN
core/game_menu/assets/page_1/barretta_second.png
Normal file
BIN
core/game_menu/assets/page_1/barretta_second.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
40
core/game_menu/assets/page_1/barretta_second.png.import
Normal file
40
core/game_menu/assets/page_1/barretta_second.png.import
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://ct7o3u6i5rka6"
|
||||||
|
path="res://.godot/imported/barretta_second.png-7f0af7da51c3ebb821e017a3fe148c6e.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://core/game_menu/assets/page_1/barretta_second.png"
|
||||||
|
dest_files=["res://.godot/imported/barretta_second.png-7f0af7da51c3ebb821e017a3fe148c6e.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[ext_resource type="Script" uid="uid://c7q3d823b1v1h" path="res://core/game_menu/biome_picker.gd" id="1_jqji0"]
|
[ext_resource type="Script" uid="uid://c7q3d823b1v1h" path="res://core/game_menu/biome_picker.gd" id="1_jqji0"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dc0sl04wem136" path="res://core/game_menu/assets/page_1/color_main_biome.png" id="2_8s4h5"]
|
[ext_resource type="Texture2D" uid="uid://dc0sl04wem136" path="res://core/game_menu/assets/page_1/color_main_biome.png" id="2_8s4h5"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dj6pt25w5i4jq" path="res://core/game_menu/assets/page_1/lucchetto.png" id="2_jqji0"]
|
[ext_resource type="Texture2D" uid="uid://bx6gsh5uchkge" path="res://core/game_menu/assets/lock.png" id="3_jqji0"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_jqji0"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_jqji0"]
|
||||||
|
|
||||||
@@ -65,18 +65,19 @@ stretch_mode = 3
|
|||||||
[node name="TextureRect" type="TextureRect" parent="Texture" unique_id=288045010]
|
[node name="TextureRect" type="TextureRect" parent="Texture" unique_id=288045010]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = -1
|
anchors_preset = 8
|
||||||
anchor_left = 0.36645964
|
anchor_left = 0.5
|
||||||
anchor_top = 0.41690964
|
anchor_top = 0.5
|
||||||
anchor_right = 0.6335404
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.58309036
|
anchor_bottom = 0.5
|
||||||
offset_left = 1.5
|
offset_left = -26.8755
|
||||||
offset_top = 8.5
|
offset_top = -34.375504
|
||||||
offset_right = -1.5
|
offset_right = 26.8755
|
||||||
offset_bottom = -8.5
|
offset_bottom = 34.375504
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
texture = ExtResource("2_jqji0")
|
texture = ExtResource("3_jqji0")
|
||||||
|
expand_mode = 1
|
||||||
|
|
||||||
[connection signal="pressed" from="." to="." method="_on_pressed"]
|
[connection signal="pressed" from="." to="." method="_on_pressed"]
|
||||||
|
|||||||
@@ -25,9 +25,11 @@ grow_vertical = 2
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchor_left = 0.3625
|
anchor_left = 0.3625
|
||||||
anchor_top = 0.14351852
|
anchor_top = 0.21481481
|
||||||
anchor_right = 0.6375
|
anchor_right = 0.6375
|
||||||
anchor_bottom = 0.8564815
|
anchor_bottom = 0.78518516
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="ColorRect" parent="Photo" index="0" unique_id=1208008621]
|
[node name="ColorRect" parent="Photo" index="0" unique_id=1208008621]
|
||||||
@@ -37,6 +39,12 @@ offset_top = 0.0
|
|||||||
offset_right = 0.0
|
offset_right = 0.0
|
||||||
offset_bottom = 0.0
|
offset_bottom = 0.0
|
||||||
|
|
||||||
|
[node name="MarginContainer" parent="Photo/ColorRect" index="0" unique_id=1141643525]
|
||||||
|
theme_override_constants/margin_left = 56
|
||||||
|
theme_override_constants/margin_top = 60
|
||||||
|
theme_override_constants/margin_right = 56
|
||||||
|
theme_override_constants/margin_bottom = 200
|
||||||
|
|
||||||
[connection signal="gui_input" from="Panel" to="." method="_on_panel_gui_input"]
|
[connection signal="gui_input" from="Panel" to="." method="_on_panel_gui_input"]
|
||||||
|
|
||||||
[editable path="Photo"]
|
[editable path="Photo"]
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ layout_mode = 2
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
expand_mode = 1
|
expand_mode = 1
|
||||||
stretch_mode = 6
|
stretch_mode = 5
|
||||||
|
|
||||||
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
||||||
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
[ext_resource type="Script" uid="uid://8k1msabobhks" path="res://core/game_menu/train_selector.gd" id="1_puip6"]
|
[ext_resource type="Script" uid="uid://8k1msabobhks" path="res://core/game_menu/train_selector.gd" id="1_puip6"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bjqp8kmb5y7px" path="res://core/game_menu/assets/page_1/chooseyourtrain_text.png" id="2_cfvtr"]
|
[ext_resource type="Texture2D" uid="uid://bjqp8kmb5y7px" path="res://core/game_menu/assets/page_1/chooseyourtrain_text.png" id="2_cfvtr"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dm3skv22c60tm" path="res://core/game_menu/arrow_button.tscn" id="2_puip6"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://ch1st1oryjoio" path="res://core/game_menu/color_picker.tscn" id="3_i2rs1"]
|
[ext_resource type="PackedScene" uid="uid://ch1st1oryjoio" path="res://core/game_menu/color_picker.tscn" id="3_i2rs1"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://d2s020wikunuo" path="res://core/game_menu/assets/page_1/barretta_main.png" id="4_ftlwq"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://ct7o3u6i5rka6" path="res://core/game_menu/assets/page_1/barretta_second.png" id="6_y1o8e"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dxun0jk5t0n6" path="res://core/tween/container_tween.tscn" id="10_i2rs1"]
|
[ext_resource type="PackedScene" uid="uid://dxun0jk5t0n6" path="res://core/tween/container_tween.tscn" id="10_i2rs1"]
|
||||||
[ext_resource type="PackedScene" uid="uid://otptvwer4par" path="res://tgcc/train/train.tscn" id="11_train"]
|
[ext_resource type="PackedScene" uid="uid://otptvwer4par" path="res://tgcc/train/train.tscn" id="11_train"]
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ stretch = true
|
|||||||
own_world_3d = true
|
own_world_3d = true
|
||||||
transparent_bg = true
|
transparent_bg = true
|
||||||
handle_input_locally = false
|
handle_input_locally = false
|
||||||
size = Vector2i(660, 180)
|
size = Vector2i(625, 180)
|
||||||
render_target_update_mode = 4
|
render_target_update_mode = 4
|
||||||
|
|
||||||
[node name="Camera3D" type="Camera3D" parent="TrainViewportContainer/SubViewport" unique_id=1674220602]
|
[node name="Camera3D" type="Camera3D" parent="TrainViewportContainer/SubViewport" unique_id=1674220602]
|
||||||
@@ -43,59 +44,116 @@ transform = Transform3D(0.707107, -0.5, 0.5, 0, 0.707107, 0.707107, -0.707107, -
|
|||||||
|
|
||||||
[node name="Treno" parent="TrainViewportContainer/SubViewport" unique_id=1674220603 instance=ExtResource("11_train")]
|
[node name="Treno" parent="TrainViewportContainer/SubViewport" unique_id=1674220603 instance=ExtResource("11_train")]
|
||||||
|
|
||||||
[node name="HBoxContainer2" type="HBoxContainer" parent="." unique_id=607833319]
|
[node name="TextureRect" type="TextureRect" parent="." unique_id=338929443]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
alignment = 1
|
mouse_filter = 2
|
||||||
|
texture = ExtResource("4_ftlwq")
|
||||||
|
|
||||||
[node name="ArrowButtonLeft" parent="HBoxContainer2" unique_id=103192648 instance=ExtResource("2_puip6")]
|
[node name="MarginContainer" type="MarginContainer" parent="TextureRect" unique_id=616392028]
|
||||||
unique_name_in_owner = true
|
layout_mode = 1
|
||||||
layout_mode = 2
|
anchors_preset = 15
|
||||||
flip_h = true
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
theme_override_constants/margin_left = 116
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer2" unique_id=1364417494]
|
[node name="HBoxContainer" type="HBoxContainer" parent="TextureRect/MarginContainer" unique_id=1364417494]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/separation = 0
|
theme_override_constants/separation = 0
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
|
||||||
[node name="ColorPicker1" parent="HBoxContainer2/HBoxContainer" unique_id=59169767 instance=ExtResource("3_i2rs1")]
|
[node name="ColorPicker1" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=59169767 instance=ExtResource("3_i2rs1")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
color = Color(0.7432059, 0.5684909, 1, 1)
|
color = Color(0.7432059, 0.5684909, 1, 1)
|
||||||
|
|
||||||
[node name="ColorPicker2" parent="HBoxContainer2/HBoxContainer" unique_id=584054476 instance=ExtResource("3_i2rs1")]
|
[node name="ColorPicker2" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=584054476 instance=ExtResource("3_i2rs1")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
color = Color(0.47657922, 0.8792635, 0.8823829, 1)
|
color = Color(0.47657922, 0.8792635, 0.8823829, 1)
|
||||||
|
|
||||||
[node name="ColorPicker3" parent="HBoxContainer2/HBoxContainer" unique_id=889429149 instance=ExtResource("3_i2rs1")]
|
[node name="ColorPicker3" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=889429149 instance=ExtResource("3_i2rs1")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
color = Color(0.54004896, 0.5516501, 0.45533067, 1)
|
color = Color(0.54004896, 0.5516501, 0.45533067, 1)
|
||||||
|
|
||||||
[node name="ColorPicker4" parent="HBoxContainer2/HBoxContainer" unique_id=466686411 instance=ExtResource("3_i2rs1")]
|
[node name="ColorPicker4" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=466686411 instance=ExtResource("3_i2rs1")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
color = Color(0.40863404, 1, 0.47657922, 1)
|
color = Color(0.40863404, 1, 0.47657922, 1)
|
||||||
|
|
||||||
[node name="ColorPicker5" parent="HBoxContainer2/HBoxContainer" unique_id=675841518 instance=ExtResource("3_i2rs1")]
|
[node name="ColorPicker5" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=675841518 instance=ExtResource("3_i2rs1")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
color = Color(1, 0, 0, 1)
|
color = Color(1, 0, 0, 1)
|
||||||
|
|
||||||
[node name="ColorPicker6" parent="HBoxContainer2/HBoxContainer" unique_id=1698412911 instance=ExtResource("3_i2rs1")]
|
[node name="ColorPicker6" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=1698412911 instance=ExtResource("3_i2rs1")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
|
|
||||||
[node name="ArrowButtonRight" parent="HBoxContainer2" unique_id=68298624 instance=ExtResource("2_puip6")]
|
[node name="TextureRect2" type="TextureRect" parent="." unique_id=1180760395]
|
||||||
|
layout_mode = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
texture = ExtResource("6_y1o8e")
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="TextureRect2" unique_id=651764288]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
theme_override_constants/margin_left = 116
|
||||||
|
|
||||||
|
[node name="HBoxContainer2" type="HBoxContainer" parent="TextureRect2/MarginContainer" unique_id=2122540668]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 0
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="ColorPicker7" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=1664685328 instance=ExtResource("3_i2rs1")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 4
|
||||||
|
color = Color(0.7432059, 0.5684909, 1, 1)
|
||||||
|
|
||||||
|
[node name="ColorPicker8" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=396324135 instance=ExtResource("3_i2rs1")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 4
|
||||||
|
color = Color(0.47657922, 0.8792635, 0.8823829, 1)
|
||||||
|
|
||||||
|
[node name="ColorPicker9" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=1233950004 instance=ExtResource("3_i2rs1")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 4
|
||||||
|
color = Color(0.54004896, 0.5516501, 0.45533067, 1)
|
||||||
|
|
||||||
|
[node name="ColorPicker10" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=2132596175 instance=ExtResource("3_i2rs1")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 4
|
||||||
|
color = Color(0.40863404, 1, 0.47657922, 1)
|
||||||
|
|
||||||
|
[node name="ColorPicker11" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=831493295 instance=ExtResource("3_i2rs1")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 4
|
||||||
|
color = Color(1, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="ColorPicker12" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=170636843 instance=ExtResource("3_i2rs1")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 4
|
||||||
|
|
||||||
[node name="ContainerTween" parent="." unique_id=160227524 node_paths=PackedStringArray("targets") instance=ExtResource("10_i2rs1")]
|
[node name="ContainerTween" parent="." unique_id=160227524 node_paths=PackedStringArray("targets") instance=ExtResource("10_i2rs1")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
targets = [NodePath("../HBoxContainer2/ArrowButtonLeft"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker1"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker2"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker3"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker4"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker5"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker6"), NodePath("../HBoxContainer2/ArrowButtonRight")]
|
targets = [NodePath(""), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker1"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker2"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker3"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker4"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker5"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker6"), NodePath("")]
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -29,12 +29,27 @@ var is_loaded: bool = false
|
|||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
load_game()
|
load_game()
|
||||||
apply_video_settings()
|
apply_video_settings()
|
||||||
|
apply_train_colors()
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if not get_tree().paused and is_loaded:
|
||||||
|
save_data.total_time_played_seconds += delta
|
||||||
|
|
||||||
func apply_video_settings() -> void:
|
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 = Viewport.MSAA_DISABLED
|
get_viewport().msaa_2d = msaa_mode
|
||||||
|
|
||||||
|
func apply_train_colors() -> void:
|
||||||
|
if not save_data.train_color_1.is_empty():
|
||||||
|
var mat1: ShaderMaterial = load("res://tgcc/train/Color1_train.tres")
|
||||||
|
if mat1:
|
||||||
|
mat1.set_shader_parameter("albedo_color", Color(save_data.train_color_1))
|
||||||
|
if not save_data.train_color_2.is_empty():
|
||||||
|
var mat2: ShaderMaterial = load("res://tgcc/train/Color2_train.tres")
|
||||||
|
if mat2:
|
||||||
|
mat2.set_shader_parameter("albedo_color", Color(save_data.train_color_2))
|
||||||
|
|
||||||
match save_data.window_mode_index:
|
match save_data.window_mode_index:
|
||||||
0:
|
0:
|
||||||
@@ -49,18 +64,9 @@ 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_position: Vector2i = DisplayServer.screen_get_position()
|
var screen_center = DisplayServer.screen_get_position() + DisplayServer.screen_get_size() / 2
|
||||||
var screen_size: Vector2i = DisplayServer.screen_get_size()
|
var window_size = DisplayServer.window_get_size()
|
||||||
var window_size: Vector2i = DisplayServer.window_get_size()
|
DisplayServer.window_set_position(screen_center - window_size / 2)
|
||||||
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:
|
||||||
|
|||||||
@@ -9,6 +9,13 @@ var anti_aliasing: bool = true
|
|||||||
var window_mode_index: int = 0
|
var window_mode_index: int = 0
|
||||||
var resolution_x: int = 1920
|
var resolution_x: int = 1920
|
||||||
var resolution_y: int = 1080
|
var resolution_y: int = 1080
|
||||||
|
var train_color_1: String = ""
|
||||||
|
var train_color_2: String = ""
|
||||||
|
var train_color_1_index: int = 0
|
||||||
|
var train_color_2_index: int = 0
|
||||||
|
|
||||||
|
var total_distance_km: float = 0.0
|
||||||
|
var total_time_played_seconds: float = 0.0
|
||||||
|
|
||||||
func to_dictionary() -> Dictionary:
|
func to_dictionary() -> Dictionary:
|
||||||
var serialized_collectible_ids: Array[String] = []
|
var serialized_collectible_ids: Array[String] = []
|
||||||
@@ -23,6 +30,12 @@ func to_dictionary() -> Dictionary:
|
|||||||
"window_mode_index": window_mode_index,
|
"window_mode_index": window_mode_index,
|
||||||
"resolution_x": resolution_x,
|
"resolution_x": resolution_x,
|
||||||
"resolution_y": resolution_y,
|
"resolution_y": resolution_y,
|
||||||
|
"train_color_1": train_color_1,
|
||||||
|
"train_color_2": train_color_2,
|
||||||
|
"train_color_1_index": train_color_1_index,
|
||||||
|
"train_color_2_index": train_color_2_index,
|
||||||
|
"total_distance_km": total_distance_km,
|
||||||
|
"total_time_played_seconds": total_time_played_seconds,
|
||||||
}
|
}
|
||||||
|
|
||||||
static func from_dictionary(data: Dictionary) -> SaveGameData:
|
static func from_dictionary(data: Dictionary) -> SaveGameData:
|
||||||
@@ -52,4 +65,22 @@ static func from_dictionary(data: Dictionary) -> SaveGameData:
|
|||||||
if data.has("resolution_y"):
|
if data.has("resolution_y"):
|
||||||
save_game_data.resolution_y = int(data["resolution_y"])
|
save_game_data.resolution_y = int(data["resolution_y"])
|
||||||
|
|
||||||
|
if data.has("train_color_1"):
|
||||||
|
save_game_data.train_color_1 = str(data["train_color_1"])
|
||||||
|
|
||||||
|
if data.has("train_color_2"):
|
||||||
|
save_game_data.train_color_2 = str(data["train_color_2"])
|
||||||
|
|
||||||
|
if data.has("train_color_1_index"):
|
||||||
|
save_game_data.train_color_1_index = int(data["train_color_1_index"])
|
||||||
|
|
||||||
|
if data.has("train_color_2_index"):
|
||||||
|
save_game_data.train_color_2_index = int(data["train_color_2_index"])
|
||||||
|
|
||||||
|
if data.has("total_distance_km"):
|
||||||
|
save_game_data.total_distance_km = float(data["total_distance_km"])
|
||||||
|
|
||||||
|
if data.has("total_time_played_seconds"):
|
||||||
|
save_game_data.total_time_played_seconds = float(data["total_time_played_seconds"])
|
||||||
|
|
||||||
return save_game_data
|
return save_game_data
|
||||||
|
|||||||
BIN
core/main_scene_ui/assets/button_customize.png
Normal file
BIN
core/main_scene_ui/assets/button_customize.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 774 KiB |
40
core/main_scene_ui/assets/button_customize.png.import
Normal file
40
core/main_scene_ui/assets/button_customize.png.import
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c31yut8p24t8g"
|
||||||
|
path="res://.godot/imported/button_customize.png-2b9ab16ca23c28488847c768be1934d0.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://core/main_scene_ui/assets/button_customize.png"
|
||||||
|
dest_files=["res://.godot/imported/button_customize.png-2b9ab16ca23c28488847c768be1934d0.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -1,9 +1,13 @@
|
|||||||
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
|
||||||
|
@onready var hide_ui_button: Button = $%HideUIButton
|
||||||
|
@onready var customize_train_button: Button = $%CustomizeTrainButton
|
||||||
@onready var photo_icon_button: Button = $%PhotoIconButton
|
@onready var photo_icon_button: Button = $%PhotoIconButton
|
||||||
|
@onready var choo_choo_button: Button = $%ChooChooButton
|
||||||
@onready var collectible_icon_button: Button = $%CollectibleIconButton
|
@onready var collectible_icon_button: Button = $%CollectibleIconButton
|
||||||
@onready var resume_button: Button = $GameMenuPanel/GameMenu/Pages/Page3/OptionMenu/VBoxContainer/ResumeButton
|
@onready var resume_button: Button = $GameMenuPanel/GameMenu/Pages/Page3/OptionMenu/VBoxContainer/ResumeButton
|
||||||
@onready var weather_row: HBoxContainer = $%WeatherRow
|
@onready var weather_row: HBoxContainer = $%WeatherRow
|
||||||
@@ -12,6 +16,8 @@ extends Control
|
|||||||
@onready var photo_mode_texture_mask: TextureRect = $%PhotoModeTextureMask
|
@onready var photo_mode_texture_mask: TextureRect = $%PhotoModeTextureMask
|
||||||
@onready var photo_mode_black_screen: ColorRect = $%PhotoModeBlackScreen
|
@onready var photo_mode_black_screen: ColorRect = $%PhotoModeBlackScreen
|
||||||
@onready var audio_player: Control = $%AudioPlayer
|
@onready var audio_player: Control = $%AudioPlayer
|
||||||
|
@onready var time_label: Label = $%TimeLabel
|
||||||
|
@onready var dist_label: Label = $%DistLabel
|
||||||
|
|
||||||
var _cycle = false
|
var _cycle = false
|
||||||
var _rain = false
|
var _rain = false
|
||||||
@@ -23,29 +29,47 @@ var _photo_mode_alpha_tween: Tween
|
|||||||
var _photo_mode_fold_tween: Tween
|
var _photo_mode_fold_tween: Tween
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
set_process_input(false)
|
||||||
GameState.on_enable_photo_mode_request.connect(_on_enable_photo_mode)
|
GameState.on_enable_photo_mode_request.connect(_on_enable_photo_mode)
|
||||||
GameState.on_disable_photo_mode_request.connect(_on_disable_photo_mode)
|
GameState.on_disable_photo_mode_request.connect(_on_disable_photo_mode)
|
||||||
GameState.on_photo_taken_started.connect(_on_photo_taken_started)
|
GameState.on_photo_taken_started.connect(_on_photo_taken_started)
|
||||||
GameState.on_photo_taken_finished.connect(_on_photo_taken_finished)
|
GameState.on_photo_taken_finished.connect(_on_photo_taken_finished)
|
||||||
GameState.on_photo_taken_prepare.connect(_on_photo_capture_prepare)
|
GameState.on_photo_taken_prepare.connect(_on_photo_capture_prepare)
|
||||||
menu_icon_button.pressed.connect(_on_menu_icon_button_pressed)
|
hide_ui_button.pressed.connect(_on_hide_ui_button_pressed)
|
||||||
|
customize_train_button.pressed.connect(_open_game_menu_on_page.bind(0))
|
||||||
|
collectible_icon_button.pressed.connect(_open_game_menu_on_page.bind(1))
|
||||||
|
menu_icon_button.pressed.connect(_open_game_menu_on_page.bind(2))
|
||||||
photo_icon_button.pressed.connect(_on_photo_icon_button_pressed)
|
photo_icon_button.pressed.connect(_on_photo_icon_button_pressed)
|
||||||
collectible_icon_button.pressed.connect(_on_collectible_icon_button_pressed)
|
choo_choo_button.pressed.connect(_on_choo_choo_button_pressed)
|
||||||
resume_button.pressed.connect(_on_resume_button_pressed)
|
resume_button.pressed.connect(_on_resume_button_pressed)
|
||||||
|
|
||||||
func _on_menu_icon_button_pressed() -> void:
|
func _process(delta: float) -> void:
|
||||||
GameState.pause_game()
|
if time_label and dist_label and GameState.is_loaded:
|
||||||
game_menu_panel.show()
|
var time = GameState.save_data.total_time_played_seconds
|
||||||
game_menu.scale = Vector2(1, 1)
|
var hours = int(time) / 3600
|
||||||
game_menu.open()
|
var minutes = (int(time) % 3600) / 60
|
||||||
TweenFX.fold_in(game_menu)
|
var seconds = int(time) % 60
|
||||||
|
time_label.text = "Travel Time: %02d:%02d:%02d" % [hours, minutes, seconds]
|
||||||
|
dist_label.text = "Distance Traveled: %d km" % int(GameState.save_data.total_distance_km)
|
||||||
|
|
||||||
|
func _on_hide_ui_button_pressed() -> void:
|
||||||
|
hide_ui()
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||||
|
await get_tree().create_timer(0.3).timeout
|
||||||
|
set_process_input(true)
|
||||||
|
|
||||||
|
func _input(event: InputEvent) -> void:
|
||||||
|
if event is InputEventMouseMotion:
|
||||||
|
set_process_input(false)
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||||
|
show_ui()
|
||||||
|
|
||||||
func _on_photo_icon_button_pressed() -> void:
|
func _on_photo_icon_button_pressed() -> void:
|
||||||
GameState.on_enable_photo_mode_request.emit()
|
GameState.on_enable_photo_mode_request.emit()
|
||||||
|
|
||||||
func _on_collectible_icon_button_pressed() -> void:
|
func _open_game_menu_on_page(tab_index: int) -> void:
|
||||||
GameState.pause_game()
|
GameState.pause_game()
|
||||||
game_menu.on_tab_pressed(1, true)
|
game_menu.on_tab_pressed(tab_index, true)
|
||||||
game_menu_panel.show()
|
game_menu_panel.show()
|
||||||
game_menu.scale = Vector2(1, 1)
|
game_menu.scale = Vector2(1, 1)
|
||||||
TweenFX.fold_in(game_menu)
|
TweenFX.fold_in(game_menu)
|
||||||
@@ -88,8 +112,6 @@ 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 = []
|
||||||
@@ -102,7 +124,7 @@ func pick_random_weather() -> void:
|
|||||||
weather_row.on_icon_pressed_changed(random_button)
|
weather_row.on_icon_pressed_changed(random_button)
|
||||||
|
|
||||||
func _on_enable_photo_mode() -> void:
|
func _on_enable_photo_mode() -> void:
|
||||||
hide_ui_for_photo_mode()
|
hide_ui()
|
||||||
photo_mode_texture_mask.scale = Vector2(1,1)
|
photo_mode_texture_mask.scale = Vector2(1,1)
|
||||||
photo_mode_texture_mask.modulate.a = 0.0
|
photo_mode_texture_mask.modulate.a = 0.0
|
||||||
photo_mode_texture_panel.show()
|
photo_mode_texture_panel.show()
|
||||||
@@ -125,7 +147,7 @@ func _on_enable_photo_mode() -> void:
|
|||||||
_photo_mode_fold_tween = TweenFX.fold_in(photo_mode_texture_mask)
|
_photo_mode_fold_tween = TweenFX.fold_in(photo_mode_texture_mask)
|
||||||
|
|
||||||
func _on_disable_photo_mode() -> void:
|
func _on_disable_photo_mode() -> void:
|
||||||
show_ui_for_photo_mode()
|
show_ui()
|
||||||
var mat = photo_mode_texture_panel.material as ShaderMaterial
|
var mat = photo_mode_texture_panel.material as ShaderMaterial
|
||||||
if mat:
|
if mat:
|
||||||
if _photo_mode_mat_tween:
|
if _photo_mode_mat_tween:
|
||||||
@@ -167,27 +189,32 @@ 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 _on_choo_choo_button_pressed() -> void:
|
||||||
TweenFX.fade_out(weather_row, 0.25)
|
#play sfx
|
||||||
TweenFX.fade_out(time_of_day_row, 0.25)
|
pass
|
||||||
TweenFX.fade_out(menu_icon_button, 0.25)
|
|
||||||
TweenFX.fade_out(photo_icon_button, 0.25)
|
|
||||||
TweenFX.fade_out(collectible_icon_button, 0.25)
|
|
||||||
TweenFX.fade_out(audio_player, 0.25)
|
|
||||||
|
|
||||||
func show_ui_for_photo_mode() -> void:
|
func _set_buttons_mouse_filter(ignore: bool) -> void:
|
||||||
weather_row.show()
|
var filter = Control.MOUSE_FILTER_IGNORE if ignore else Control.MOUSE_FILTER_STOP
|
||||||
time_of_day_row.show()
|
var buttons = [hide_ui_button, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, choo_choo_button]
|
||||||
menu_icon_button.show()
|
if weather_row and "options_icon_buttons" in weather_row:
|
||||||
photo_icon_button.show()
|
buttons.append_array(weather_row.options_icon_buttons)
|
||||||
collectible_icon_button.show()
|
if time_of_day_row and "options_icon_buttons" in time_of_day_row:
|
||||||
audio_player.show()
|
buttons.append_array(time_of_day_row.options_icon_buttons)
|
||||||
TweenFX.fade_in(weather_row, 0.25)
|
|
||||||
TweenFX.fade_in(time_of_day_row, 0.25)
|
for btn in buttons:
|
||||||
TweenFX.fade_in(menu_icon_button, 0.25)
|
if btn is Control:
|
||||||
TweenFX.fade_in(photo_icon_button, 0.25)
|
btn.mouse_filter = filter
|
||||||
TweenFX.fade_in(collectible_icon_button, 0.25)
|
|
||||||
TweenFX.fade_in(audio_player, 0.25)
|
func hide_ui() -> void:
|
||||||
|
_set_buttons_mouse_filter(true)
|
||||||
|
var hud_elements = [hide_ui_button, weather_row, time_of_day_row, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, audio_player, choo_choo_button, time_label, dist_label]
|
||||||
|
for element in hud_elements:
|
||||||
|
TweenFX.fade_out(element, 0.25)
|
||||||
|
|
||||||
|
func show_ui() -> void:
|
||||||
|
_set_buttons_mouse_filter(false)
|
||||||
|
var hud_elements = [hide_ui_button, weather_row, time_of_day_row, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, audio_player, choo_choo_button, time_label, dist_label]
|
||||||
|
for element in hud_elements:
|
||||||
|
element.show()
|
||||||
|
TweenFX.fade_in(element, 0.25)
|
||||||
|
|||||||
@@ -26,7 +26,9 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://cq65xyg4wsctm" path="res://core/main_scene_ui/assets/button_weather_nowind.png" id="12_fjfwt"]
|
[ext_resource type="Texture2D" uid="uid://cq65xyg4wsctm" path="res://core/main_scene_ui/assets/button_weather_nowind.png" id="12_fjfwt"]
|
||||||
[ext_resource type="Texture2D" uid="uid://tex06svipyg4" path="res://core/main_scene_ui/assets/button_random.png" id="14_gcgq4"]
|
[ext_resource type="Texture2D" uid="uid://tex06svipyg4" path="res://core/main_scene_ui/assets/button_random.png" id="14_gcgq4"]
|
||||||
[ext_resource type="Texture2D" uid="uid://1n3paucfsovj" path="res://core/main_scene_ui/assets/button_photomode.png" id="15_th1nj"]
|
[ext_resource type="Texture2D" uid="uid://1n3paucfsovj" path="res://core/main_scene_ui/assets/button_photomode.png" id="15_th1nj"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c31yut8p24t8g" path="res://core/main_scene_ui/assets/button_customize.png" id="19_vywaj"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b03si5ir3ypp7" path="res://core/main_scene_ui/assets/button_collection03.png" id="19_yggu7"]
|
[ext_resource type="Texture2D" uid="uid://b03si5ir3ypp7" path="res://core/main_scene_ui/assets/button_collection03.png" id="19_yggu7"]
|
||||||
|
[ext_resource type="FontFile" uid="uid://bclja5no1qteh" path="res://core/font/Kestila.ttf" id="29_jn6vt"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hole"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hole"]
|
||||||
shader = ExtResource("10_shader")
|
shader = ExtResource("10_shader")
|
||||||
@@ -48,8 +50,10 @@ layout_mode = 1
|
|||||||
anchors_preset = 2
|
anchors_preset = 2
|
||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
offset_top = -164.0
|
offset_left = 20.0
|
||||||
offset_right = 80.0
|
offset_top = -184.0
|
||||||
|
offset_right = 100.0
|
||||||
|
offset_bottom = -20.0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
|
|
||||||
[node name="TimeOfDayRow" parent="Rows" unique_id=1734127019 instance=ExtResource("2_4cc8f")]
|
[node name="TimeOfDayRow" parent="Rows" unique_id=1734127019 instance=ExtResource("2_4cc8f")]
|
||||||
@@ -132,40 +136,80 @@ data = "Random"
|
|||||||
image = ExtResource("14_gcgq4")
|
image = ExtResource("14_gcgq4")
|
||||||
apply_texture_on_selection = false
|
apply_texture_on_selection = false
|
||||||
|
|
||||||
[node name="MenuIconButton" parent="." unique_id=707872474 instance=ExtResource("3_t1xop")]
|
[node name="TopButtons" type="VBoxContainer" parent="." unique_id=1644086668]
|
||||||
unique_name_in_owner = true
|
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 1
|
anchors_preset = 1
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 0.0
|
offset_left = -100.0
|
||||||
offset_left = -80.0
|
offset_top = 20.0
|
||||||
offset_bottom = 80.0
|
offset_right = -20.0
|
||||||
|
offset_bottom = 100.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
|
theme_override_constants/separation = 8
|
||||||
|
|
||||||
|
[node name="MenuIconButton" parent="TopButtons" unique_id=707872474 instance=ExtResource("3_t1xop")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
image = ExtResource("10_6016m")
|
image = ExtResource("10_6016m")
|
||||||
|
|
||||||
[node name="CollectionOptions" type="VBoxContainer" parent="." unique_id=542153805]
|
[node name="HideUIButton" parent="TopButtons" unique_id=1621140689 instance=ExtResource("3_t1xop")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
image = ExtResource("10_6016m")
|
||||||
|
|
||||||
|
[node name="MiddleButtons" type="VBoxContainer" parent="." unique_id=542153805]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 6
|
anchors_preset = 6
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
offset_left = -40.0
|
offset_left = -100.0
|
||||||
offset_top = -20.0
|
offset_top = -124.0
|
||||||
offset_bottom = 20.0
|
offset_right = -20.0
|
||||||
|
offset_bottom = 124.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
theme_override_constants/separation = 8
|
||||||
|
|
||||||
[node name="PhotoIconButton" parent="CollectionOptions" unique_id=1863476241 instance=ExtResource("3_t1xop")]
|
[node name="CustomizeTrainButton" parent="MiddleButtons" unique_id=27430111 instance=ExtResource("3_t1xop")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
image = ExtResource("19_vywaj")
|
||||||
|
|
||||||
|
[node name="CollectibleIconButton" parent="MiddleButtons" unique_id=520235552 instance=ExtResource("3_t1xop")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
image = ExtResource("19_yggu7")
|
||||||
|
|
||||||
|
[node name="PhotoIconButton" parent="MiddleButtons" unique_id=1863476241 instance=ExtResource("3_t1xop")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
image = ExtResource("15_th1nj")
|
image = ExtResource("15_th1nj")
|
||||||
|
|
||||||
[node name="CollectibleIconButton" parent="CollectionOptions" unique_id=520235552 instance=ExtResource("3_t1xop")]
|
[node name="ChooChooButton" parent="MiddleButtons" unique_id=774819903 instance=ExtResource("3_t1xop")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
image = ExtResource("19_yggu7")
|
image = ExtResource("15_th1nj")
|
||||||
|
|
||||||
|
[node name="InfoLabels" type="VBoxContainer" parent="." unique_id=234435566]
|
||||||
|
custom_minimum_size = Vector2(400, 0)
|
||||||
|
layout_mode = 1
|
||||||
|
offset_left = 20.0
|
||||||
|
offset_top = 20.0
|
||||||
|
offset_right = 420.0
|
||||||
|
offset_bottom = 220.0
|
||||||
|
|
||||||
|
[node name="TimeLabel" type="Label" parent="InfoLabels" unique_id=18932607]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_fonts/font = ExtResource("29_jn6vt")
|
||||||
|
|
||||||
|
[node name="DistLabel" type="Label" parent="InfoLabels" unique_id=1743894966]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_fonts/font = ExtResource("29_jn6vt")
|
||||||
|
|
||||||
[node name="AudioPlayer" parent="." unique_id=425192018 node_paths=PackedStringArray("radio") instance=ExtResource("7_lapqe")]
|
[node name="AudioPlayer" parent="." unique_id=425192018 node_paths=PackedStringArray("radio") instance=ExtResource("7_lapqe")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
@@ -174,10 +218,10 @@ anchor_left = 1.0
|
|||||||
anchor_top = 0.99814814
|
anchor_top = 0.99814814
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 0.99814814
|
anchor_bottom = 0.99814814
|
||||||
offset_left = -146.0
|
offset_left = -166.0
|
||||||
offset_top = -57.0
|
offset_top = -74.0
|
||||||
offset_right = -146.0
|
offset_right = -166.0
|
||||||
offset_bottom = -57.0
|
offset_bottom = -74.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
radio = NodePath("../Radio")
|
radio = NodePath("../Radio")
|
||||||
@@ -222,18 +266,6 @@ texture = ExtResource("9_4cc8f")
|
|||||||
stretch_mode = 3
|
stretch_mode = 3
|
||||||
metadata/_edit_use_anchors_ = true
|
metadata/_edit_use_anchors_ = true
|
||||||
|
|
||||||
[node name="PhotoModeBlackScreen" type="ColorRect" parent="." unique_id=1928591477]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
visible = false
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 15
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
pivot_offset_ratio = Vector2(0.5, 0.5)
|
|
||||||
color = Color(0, 0, 0, 1)
|
|
||||||
|
|
||||||
[node name="PhotoTaken" parent="." unique_id=683693112 instance=ExtResource("8_t1xop")]
|
[node name="PhotoTaken" parent="." unique_id=683693112 instance=ExtResource("8_t1xop")]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
@@ -246,6 +278,18 @@ offset_bottom = 0.0
|
|||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="PhotoModeBlackScreen" type="ColorRect" parent="." unique_id=1928591477]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
pivot_offset_ratio = Vector2(0.5, 0.5)
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[node name="Radio" parent="." unique_id=1234112225 instance=ExtResource("5_nevjt")]
|
[node name="Radio" parent="." unique_id=1234112225 instance=ExtResource("5_nevjt")]
|
||||||
playlist = Array[AudioStream]([ExtResource("6_kd244")])
|
playlist = Array[AudioStream]([ExtResource("6_kd244")])
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,13 @@ extends Control
|
|||||||
|
|
||||||
var initial_pos_saved := false
|
var initial_pos_saved := false
|
||||||
var initial_pos: Vector2
|
var initial_pos: Vector2
|
||||||
|
var appear_tween: Tween
|
||||||
var move_tween: Tween
|
var move_tween: Tween
|
||||||
var is_photo_mode_enable = false
|
var is_photo_mode_enable = false
|
||||||
var current_execution: int = 0
|
var current_execution: int = 0
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
CollectionManager.on_photo_saved.connect(_set_photo_taken)
|
CollectionManager.on_photo_preview_ready.connect(_set_photo_preview)
|
||||||
GameState.on_enable_photo_mode_request.connect(_on_enable_photo_mode)
|
GameState.on_enable_photo_mode_request.connect(_on_enable_photo_mode)
|
||||||
GameState.on_disable_photo_mode_request.connect(_on_disable_photo_mode)
|
GameState.on_disable_photo_mode_request.connect(_on_disable_photo_mode)
|
||||||
GameState.on_photo_taken_finished.connect(_show_photo_taken)
|
GameState.on_photo_taken_finished.connect(_show_photo_taken)
|
||||||
@@ -19,8 +20,7 @@ func _ready() -> void:
|
|||||||
func _hide_photo_taken() -> void:
|
func _hide_photo_taken() -> void:
|
||||||
hide()
|
hide()
|
||||||
|
|
||||||
func _set_photo_taken(file_path) -> void:
|
func _set_photo_preview(image: Image) -> void:
|
||||||
var image = Image.load_from_file(file_path)
|
|
||||||
if image:
|
if image:
|
||||||
var texture = ImageTexture.create_from_image(image)
|
var texture = ImageTexture.create_from_image(image)
|
||||||
photo_texture.texture = texture
|
photo_texture.texture = texture
|
||||||
@@ -41,12 +41,17 @@ func _show_photo_taken() -> void:
|
|||||||
rotation_degrees = 0.0
|
rotation_degrees = 0.0
|
||||||
show()
|
show()
|
||||||
|
|
||||||
var explode_tween_duration = 5.5
|
var appear_duration = 0.8
|
||||||
|
var float_duration = 1.5
|
||||||
var move_tween_duration = 1.0
|
var move_tween_duration = 1.0
|
||||||
|
var shrink_duration = 1
|
||||||
|
var scale_amt = 3.0
|
||||||
|
|
||||||
var explode_tween = TweenFX.explode(self, explode_tween_duration, 3)
|
appear_tween = create_tween()
|
||||||
|
appear_tween.tween_property(self, "scale", Vector2.ONE * scale_amt, appear_duration).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT)
|
||||||
|
appear_tween.parallel().tween_property(self, "rotation_degrees", randf_range(-10, 10), appear_duration * 0.8)
|
||||||
|
|
||||||
await get_tree().create_timer(explode_tween_duration / 2).timeout
|
await get_tree().create_timer(appear_duration + float_duration).timeout
|
||||||
|
|
||||||
if my_execution != current_execution:
|
if my_execution != current_execution:
|
||||||
return
|
return
|
||||||
@@ -61,10 +66,14 @@ func _show_photo_taken() -> void:
|
|||||||
|
|
||||||
move_tween = create_tween()
|
move_tween = create_tween()
|
||||||
var target_pos = collectible_button.global_position
|
var target_pos = collectible_button.global_position
|
||||||
|
|
||||||
move_tween.tween_property(self, "global_position:x", target_pos.x, move_tween_duration).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
move_tween.tween_property(self, "global_position:x", target_pos.x, move_tween_duration).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
||||||
move_tween.parallel().tween_property(self, "global_position:y", target_pos.y, move_tween_duration).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_IN)
|
move_tween.parallel().tween_property(self, "global_position:y", target_pos.y, move_tween_duration).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_IN)
|
||||||
|
|
||||||
await explode_tween.finished
|
move_tween.parallel().tween_property(self, "scale", Vector2.ONE * 0.1, shrink_duration).set_trans(Tween.TRANS_CUBIC).set_ease(Tween.EASE_IN_OUT)
|
||||||
|
move_tween.parallel().tween_property(self, "modulate:a", 0.0, shrink_duration).set_trans(Tween.TRANS_LINEAR)
|
||||||
|
|
||||||
|
await move_tween.finished
|
||||||
|
|
||||||
if my_execution != current_execution:
|
if my_execution != current_execution:
|
||||||
return
|
return
|
||||||
@@ -90,6 +99,8 @@ func _on_disable_photo_mode() -> void:
|
|||||||
|
|
||||||
func reset() -> void:
|
func reset() -> void:
|
||||||
TweenFX.stop_all(self)
|
TweenFX.stop_all(self)
|
||||||
|
if appear_tween:
|
||||||
|
appear_tween.kill()
|
||||||
if move_tween:
|
if move_tween:
|
||||||
move_tween.kill()
|
move_tween.kill()
|
||||||
hide()
|
hide()
|
||||||
|
|||||||
@@ -45,4 +45,4 @@ layout_mode = 2
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
expand_mode = 1
|
expand_mode = 1
|
||||||
stretch_mode = 6
|
stretch_mode = 5
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
## 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 +0,0 @@
|
|||||||
uid://c2usnexa5x7pg
|
|
||||||
@@ -2,6 +2,7 @@ extends Node
|
|||||||
|
|
||||||
signal on_collectible_unlocked(collectible_id: StringName)
|
signal on_collectible_unlocked(collectible_id: StringName)
|
||||||
signal on_photo_saved(filePath: String)
|
signal on_photo_saved(filePath: String)
|
||||||
|
signal on_photo_preview_ready(image: Image)
|
||||||
|
|
||||||
@export var collectibles_library: CollectibleLibrary
|
@export var collectibles_library: CollectibleLibrary
|
||||||
|
|
||||||
@@ -35,14 +36,18 @@ func save_photo_to_disk_async(image: Image) -> void:
|
|||||||
if not image:
|
if not image:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
if not DirAccess.dir_exists_absolute("user://photos"):
|
if not DirAccess.dir_exists_absolute("user://photos"):
|
||||||
DirAccess.make_dir_absolute("user://photos")
|
DirAccess.make_dir_absolute("user://photos")
|
||||||
|
|
||||||
var timestamp = str(Time.get_unix_time_from_system())
|
var timestamp = str(Time.get_unix_time_from_system())
|
||||||
var file_path = "user://photos/photo_" + timestamp + ".png"
|
var file_path = "user://photos/photo_" + timestamp + ".png"
|
||||||
image.save_png(file_path)
|
|
||||||
|
|
||||||
|
WorkerThreadPool.add_task(func():
|
||||||
|
image.save_png(file_path)
|
||||||
|
call_deferred("_on_photo_saved_callback", file_path)
|
||||||
|
)
|
||||||
|
|
||||||
|
func _on_photo_saved_callback(file_path: String) -> void:
|
||||||
saved_photos.append(file_path)
|
saved_photos.append(file_path)
|
||||||
sync_save_data()
|
sync_save_data()
|
||||||
on_photo_saved.emit(file_path)
|
on_photo_saved.emit(file_path)
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ func take_photo_async() -> void:
|
|||||||
var targets = get_tree().get_nodes_in_group("collectible")
|
var targets = get_tree().get_nodes_in_group("collectible")
|
||||||
var space_state = get_world_3d().direct_space_state
|
var space_state = get_world_3d().direct_space_state
|
||||||
|
|
||||||
|
CollectionManager.on_photo_preview_ready.emit(captured_image)
|
||||||
CollectionManager.save_photo_to_disk_async(captured_image)
|
CollectionManager.save_photo_to_disk_async(captured_image)
|
||||||
|
|
||||||
for target in targets:
|
for target in targets:
|
||||||
@@ -138,6 +139,10 @@ func take_photo_async() -> void:
|
|||||||
CollectionManager.unlock_collectible(target.collectible_data.id)
|
CollectionManager.unlock_collectible(target.collectible_data.id)
|
||||||
|
|
||||||
GameState.save_game()
|
GameState.save_game()
|
||||||
|
|
||||||
|
var shutter_stay_duration = 0.15
|
||||||
|
await get_tree().create_timer(shutter_stay_duration).timeout
|
||||||
|
|
||||||
GameState.on_photo_taken_finished.emit()
|
GameState.on_photo_taken_finished.emit()
|
||||||
|
|
||||||
func _on_photo_mode_black_screen_disappeared() -> void:
|
func _on_photo_mode_black_screen_disappeared() -> void:
|
||||||
|
|||||||
@@ -4,22 +4,23 @@ 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_CHANGE_METEO",
|
"ACH_DISTANCE_100",
|
||||||
"ACH_CHANGE_TRAIN_COLOR",
|
"ACH_DISTANCE_200",
|
||||||
|
"ACH_10_PHOTOS",
|
||||||
]
|
]
|
||||||
|
|
||||||
#how it works:
|
#how it works:
|
||||||
#func _on_player_won() -> void:
|
#func _on_player_won() -> void:
|
||||||
# AchievementManager.unlock("ACH_DISTANCE_100") #unlock the achievement at first win
|
# Achievements.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 StatsManager.get_int("stat_distance_km") >= 100:
|
# if Stats.get_int("stat_distance_km") >= 100:
|
||||||
# AchievementManager.unlock("ACH_DISTANCE_100")
|
# Achievements.unlock("ACH_DISTANCE_100")
|
||||||
# if StatsManager.get_int("stat_distance_km") >= 200:
|
# if Stats.get_int("stat_distance_km") >= 200:
|
||||||
# AchievementManager.unlock("ACH_DISTANCE_200")
|
# Achievements.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_time_played",
|
"stat_games_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:
|
||||||
# StatsManager.add_int("stat_time_played", 1)
|
# Stats.add_int("stat_games_played", 1)
|
||||||
# StatsManager.set_int("stat_total_score", StatsManager.get_int("stat_total_score") + score)
|
# Stats.set_int("stat_total_score", Stats.get_int("stat_total_score") + score)
|
||||||
# StatsManager.store() #only one push at the end of the game
|
# Stats.store() #only one push at the end of the game
|
||||||
# if StatsManager.get_int("stat_time_played") >= 10:
|
# if Stats.get_int("stat_games_played") >= 10:
|
||||||
# AchievementManager.unlock("ACH_PLAY_10_HOURS") #it call storeStats()
|
# Achievements.unlock("ACH_PLAY_10_GAMES") #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:
|
||||||
if !Steam.resetAllStats(include_achievements):
|
Steam.resetAllStats(include_achievements)
|
||||||
push_error("resetAllStats failed")
|
Steam.storeStats()
|
||||||
|
|
||||||
func _on_stats_stored(_game: int, result: int) -> void:
|
func _on_stats_stored(_game: int, result: int) -> void:
|
||||||
if !result:
|
if !result:
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
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 +0,0 @@
|
|||||||
uid://ovrd5ydp8p0q
|
|
||||||
@@ -43,7 +43,3 @@ 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,9 +107,3 @@ 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,7 +65,6 @@
|
|||||||
[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"]
|
||||||
@@ -219,11 +218,6 @@ 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")])
|
||||||
@@ -268,6 +262,7 @@ 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
|
||||||
@@ -353,29 +348,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 = "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
|
||||||
@@ -507,34 +479,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 = "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
|
||||||
@@ -549,6 +493,9 @@ 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"]
|
||||||
@@ -563,8 +510,6 @@ text = "Update Rails"
|
|||||||
[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"]
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -1,19 +0,0 @@
|
|||||||
[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
|
|
||||||
Binary file not shown.
@@ -1,19 +0,0 @@
|
|||||||
[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
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
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 +0,0 @@
|
|||||||
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" path="res://tgcc/train/train.gd" id="9_4qk3b"]
|
[ext_resource type="Script" uid="uid://5frq4qrokiy2" path="res://tgcc/train/train_glass_emission.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