diff --git a/godot/Level/Island.tscn b/godot/Level/Island.tscn index 64023ef..f27566f 100644 --- a/godot/Level/Island.tscn +++ b/godot/Level/Island.tscn @@ -491,6 +491,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.75088, 2.39766, -4.28161) [node name="Crate4" parent="." instance=ExtResource("28_x0lrj")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.31447, 2.55588, -2.13044) +[node name="Timer" type="Timer" parent="."] + [connection signal="finished" from="Music" to="Music" method="_on_finished"] [connection signal="timeout" from="Music/Transition" to="Music" method="_on_transition_timer_timeout"] [connection signal="timeout" from="Music/Tween" to="Music" method="_on_tween_timer_timeout"] diff --git a/godot/Level/World/DayNightEnvironment.gd b/godot/Level/World/DayNightEnvironment.gd new file mode 100644 index 0000000..95ace35 --- /dev/null +++ b/godot/Level/World/DayNightEnvironment.gd @@ -0,0 +1,16 @@ +extends Node3D + +var we = [ + preload("res://Level/World/world_environment.tscn"), + preload("res://Level/World/world_environment2.tscn"), +] +var current = null + +func _ready(): + randomize_env() + +func randomize_env(): + if current: + current.queue_free() + current = we[randi() % we.size()].instantiate() + add_child(current) diff --git a/godot/Level/World/DayNightEnvironment.tscn b/godot/Level/World/DayNightEnvironment.tscn index 527f3b9..9c549af 100644 --- a/godot/Level/World/DayNightEnvironment.tscn +++ b/godot/Level/World/DayNightEnvironment.tscn @@ -1,23 +1,6 @@ -[gd_scene load_steps=8 format=3 uid="uid://6ycop5t3nra5"] +[gd_scene load_steps=4 format=3 uid="uid://6ycop5t3nra5"] -[sub_resource type="Gradient" id="Gradient_6ntap"] -colors = PackedColorArray(0, 0.447059, 0.603922, 1, 0, 0, 0, 1) - -[sub_resource type="GradientTexture2D" id="GradientTexture2D_bagcs"] -gradient = SubResource("Gradient_6ntap") -fill_from = Vector2(1, 0.525641) - -[sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_es06v"] -night_sky = SubResource("GradientTexture2D_bagcs") - -[sub_resource type="Sky" id="Sky_qcavb"] -sky_material = SubResource("PhysicalSkyMaterial_es06v") - -[sub_resource type="Environment" id="Environment_d42bf"] -background_mode = 2 -background_energy_multiplier = 0.5 -sky = SubResource("Sky_qcavb") -sky_rotation = Vector3(6.28319, 0, 0) +[ext_resource type="Script" path="res://Level/World/DayNightEnvironment.gd" id="1_82go6"] [sub_resource type="Animation" id="Animation_l6y5u"] resource_name = "DayNightCycle" @@ -42,9 +25,7 @@ _data = { } [node name="DayNightEnvironment" type="Node3D"] - -[node name="WorldEnvironment" type="WorldEnvironment" parent="."] -environment = SubResource("Environment_d42bf") +script = ExtResource("1_82go6") [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] light_energy = 0.75 @@ -54,3 +35,9 @@ autoplay = "DayNightCycle" libraries = { "": SubResource("AnimationLibrary_2t5g8") } + +[node name="ChangeWorldEnvTimer" type="Timer" parent="."] +wait_time = 60.0 +autostart = true + +[connection signal="timeout" from="ChangeWorldEnvTimer" to="." method="randomize_env"] diff --git a/godot/Level/World/world_environment2.tscn b/godot/Level/World/world_environment2.tscn new file mode 100644 index 0000000..755fc4f --- /dev/null +++ b/godot/Level/World/world_environment2.tscn @@ -0,0 +1,23 @@ +[gd_scene load_steps=6 format=3 uid="uid://b7il746jn24fx"] + +[sub_resource type="Gradient" id="Gradient_6ntap"] +colors = PackedColorArray(0, 0.447059, 0.603922, 1, 0, 0, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_bagcs"] +gradient = SubResource("Gradient_6ntap") +fill_from = Vector2(1, 0.525641) + +[sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_es06v"] +night_sky = SubResource("GradientTexture2D_bagcs") + +[sub_resource type="Sky" id="Sky_qcavb"] +sky_material = SubResource("PhysicalSkyMaterial_es06v") + +[sub_resource type="Environment" id="Environment_d42bf"] +background_mode = 2 +background_energy_multiplier = 0.5 +sky = SubResource("Sky_qcavb") +sky_rotation = Vector3(6.28319, 0, 0) + +[node name="WorldEnvironment" type="WorldEnvironment"] +environment = SubResource("Environment_d42bf")