generated from krampus/template-godot4
Switch camera to demo cam on pause
This commit is contained in:
parent
7e7b09ff60
commit
7201c030e6
|
@ -334,6 +334,9 @@ visibility_aabb = AABB(-128, -4, -128, 256, 8, 256)
|
|||
process_material = SubResource("ParticleProcessMaterial_6nt4t")
|
||||
draw_pass_1 = SubResource("QuadMesh_l4j8a")
|
||||
|
||||
[node name="DemoCamera" type="Camera3D" parent="Course" groups=["DemoCamera"]]
|
||||
transform = Transform3D(-0.734269, 0.305072, -0.606448, 0, 0.893336, 0.44939, 0.678858, 0.329973, -0.655949, 143.463, 90.0707, 223.738)
|
||||
|
||||
[node name="CityBuildings" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 129.404, -9.53674e-07, 309.4)
|
||||
|
||||
|
@ -385,6 +388,9 @@ transform = Transform3D(0.57763, 0, -0.816299, 0, 1, 0, 0.816299, 0, 0.57763, 0.
|
|||
[node name="PalmTree2" parent="MountainCurve" instance=ExtResource("12_sswxf")]
|
||||
transform = Transform3D(0.184826, 0, -0.982771, 0, 1, 0, 0.982771, 0, 0.184826, 1.55019, 0, -15.9243)
|
||||
|
||||
[node name="DemoCamera" type="Camera3D" parent="MountainCurve" groups=["DemoCamera"]]
|
||||
transform = Transform3D(-0.909976, -0.0858909, 0.405667, 0, 0.978312, 0.207136, -0.41466, 0.188489, -0.890241, 21.863, 16.4413, -111.296)
|
||||
|
||||
[node name="Lakeside" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 458.103, 1.52588e-05, 204.202)
|
||||
|
||||
|
@ -419,9 +425,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 14.4011, 0.530239, -13.6932)
|
|||
[node name="Umineko3" parent="Lakeside/Flock2" instance=ExtResource("21_ch6qk")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.56348, -0.274033, -7.70535)
|
||||
|
||||
[node name="DemoCamera" type="Camera3D" parent="."]
|
||||
transform = Transform3D(-0.317113, 0.433573, -0.843477, 0, 0.88938, 0.457168, 0.948388, 0.144974, -0.282034, 461.268, 30.8271, 256.17)
|
||||
visible = false
|
||||
[node name="DemoCamera" type="Camera3D" parent="Lakeside" groups=["DemoCamera"]]
|
||||
transform = Transform3D(-0.942644, 0.108925, 0.315527, 0, 0.94526, -0.326318, -0.333799, -0.307602, -0.891044, -5.37366, 0.689307, -6.26129)
|
||||
|
||||
[node name="NorthSea" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -179.859, -2, 1062.93)
|
||||
|
|
|
@ -125,6 +125,11 @@ shot_accept={
|
|||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
shot_cancel={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
select_driver={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"key_label":0,"unicode":49,"location":0,"echo":false,"script":null)
|
||||
|
|
|
@ -465,14 +465,14 @@ func _process(delta: float) -> void:
|
|||
# TODO set power gauge parameters if needed
|
||||
character.start_upswing()
|
||||
hud.start_power_bar()
|
||||
if Input.is_action_just_pressed("ui_cancel"):
|
||||
if Input.is_action_just_pressed("shot_cancel"):
|
||||
hud.reset_power_bar()
|
||||
phase = Phase.AIM
|
||||
if Input.is_action_just_released("shot_accept") and shot_power > 0:
|
||||
hud.stop_power_bar()
|
||||
phase = Phase.CURVE_ADJUST
|
||||
Phase.CURVE_ADJUST:
|
||||
if Input.is_action_just_pressed("ui_cancel"):
|
||||
if Input.is_action_just_pressed("shot_cancel"):
|
||||
hud.reset_curve_bar()
|
||||
phase = Phase.POWER_ADJUST
|
||||
if Input.is_action_just_pressed("shot_accept"):
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
[ext_resource type="Material" uid="uid://cift6p0wn1oce" path="res://assets/materials/guard_rail.tres" id="2_1s4wy"]
|
||||
[ext_resource type="PlaneMesh" uid="uid://bdcmgvgpj1e0w" path="res://src/props/scenery/highway/guard_rail/guard_rail_post_mesh.tres" id="3_hha2c"]
|
||||
|
||||
[sub_resource type="MultiMesh" id="MultiMesh_suiix"]
|
||||
[sub_resource type="MultiMesh" id="MultiMesh_1o4mq"]
|
||||
transform_format = 1
|
||||
mesh = ExtResource("3_hha2c")
|
||||
|
||||
|
@ -42,6 +42,6 @@ path_joined = false
|
|||
material = ExtResource("2_1s4wy")
|
||||
|
||||
[node name="PostMultiMesh" type="MultiMeshInstance3D" parent="."]
|
||||
multimesh = SubResource("MultiMesh_suiix")
|
||||
multimesh = SubResource("MultiMesh_1o4mq")
|
||||
|
||||
[connection signal="curve_changed" from="." to="." method="_on_curve_changed"]
|
||||
|
|
|
@ -65,6 +65,7 @@ text = "Quit"
|
|||
|
||||
[node name="QuitConfirm" type="CenterContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
|
|
@ -492,7 +492,6 @@ transitions = ["visible", "hidden", SubResource("AnimationNodeStateMachineTransi
|
|||
graph_offset = Vector2(-309, -132)
|
||||
|
||||
[node name="ShotHUD" type="Control"]
|
||||
top_level = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
@ -580,7 +579,7 @@ anchor_right = 0.6
|
|||
anchor_bottom = 0.85
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="PowerGauge" type="Control" parent="ShotGauges"]
|
||||
layout_mode = 1
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
class_name WorldUI extends Control
|
||||
## Container & accessor for the world UI.
|
||||
|
||||
const DEMO_CAMERA_GROUP := "DemoCamera"
|
||||
|
||||
@export var pause_scene := preload("res://src/ui/menus/pause_menu/pause_menu.tscn")
|
||||
|
||||
var _prev_camera: Camera3D
|
||||
|
||||
@onready var hud_container: Control = %HUDContainer
|
||||
@onready var pause_container: Control = %PauseContainer
|
||||
|
||||
|
||||
func _unhandled_key_input(event: InputEvent) -> void:
|
||||
|
@ -16,11 +21,24 @@ func add_player_hud(hud: ShotHUD) -> void:
|
|||
|
||||
|
||||
func pause() -> void:
|
||||
# Switch to demo cam, if there is one.
|
||||
var democams: Array[Node] = get_tree().get_nodes_in_group(DEMO_CAMERA_GROUP)
|
||||
if democams:
|
||||
_prev_camera = get_viewport().get_camera_3d()
|
||||
var democam: Camera3D = democams.pick_random()
|
||||
democam.make_current()
|
||||
|
||||
var menu := pause_scene.instantiate()
|
||||
add_child(menu)
|
||||
pause_container.add_child(menu)
|
||||
menu.tree_exiting.connect(_unpause)
|
||||
hud_container.hide()
|
||||
get_tree().paused = true
|
||||
|
||||
|
||||
func _unpause() -> void:
|
||||
# Unset demo camera, if there is one.
|
||||
if is_instance_valid(_prev_camera):
|
||||
_prev_camera.make_current()
|
||||
_prev_camera = null
|
||||
hud_container.show()
|
||||
get_tree().paused = false
|
||||
|
|
|
@ -38,3 +38,13 @@ anchor_right = 1.0
|
|||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="PauseContainer" type="Control" parent="UI"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
|
|
Loading…
Reference in New Issue