generated from krampus/template-godot4
HUD show/hide animations in shot controller
This commit is contained in:
parent
cd689e93fc
commit
de1ac02832
|
@ -106,7 +106,7 @@ bones/23/rotation = Quaternion(0.000222673, 0.707107, 0.707107, -0.000222504)
|
|||
bones/23/scale = Vector3(1, 1, 1)
|
||||
|
||||
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D" index="6"]
|
||||
transform = Transform3D(-0.945, 0.31608, -0.0840753, -0.325897, -0.931726, 0.160242, -0.0276856, 0.178829, 0.983491, -0.168963, 3.13159, 0.864288)
|
||||
transform = Transform3D(-0.942953, 0.303928, 0.135893, -0.265659, -0.932915, 0.243093, 0.20066, 0.193124, 0.960437, -0.315494, 3.01329, 0.865057)
|
||||
bone_name = "Hand.R"
|
||||
bone_idx = 11
|
||||
|
||||
|
|
|
@ -99,6 +99,9 @@ var _returning_free_camera := false
|
|||
|
||||
@onready var nice_animation: AnimationPlayer = %NiceAnimation
|
||||
|
||||
@onready var hud_state_machine: AnimationTree = %HUDStateMachine
|
||||
@onready var hud_state: AnimationNodeStateMachinePlayback = hud_state_machine["parameters/playback"]
|
||||
|
||||
@onready var ball_impulse_debug: Node3D = %BallImpulseDebug
|
||||
|
||||
@onready var camera_distance := camera.position.z:
|
||||
|
@ -167,6 +170,7 @@ func take_shot() -> void:
|
|||
|
||||
func insert_free_cam() -> void:
|
||||
arrow_animation.play("hide")
|
||||
hud_state.travel("hidden")
|
||||
_free_camera = FreeCamera.create(camera)
|
||||
add_sibling(_free_camera)
|
||||
control_disabled = true
|
||||
|
@ -176,6 +180,7 @@ func insert_free_cam() -> void:
|
|||
func return_free_cam() -> void:
|
||||
# TODO alter shot aim based on free camera selection
|
||||
arrow_animation.play("show")
|
||||
hud_state.travel("visible")
|
||||
_free_camera.queue_free()
|
||||
_free_camera = null
|
||||
control_disabled = false
|
||||
|
@ -237,6 +242,7 @@ func _on_club_change(new_club: T.Club) -> void:
|
|||
func _on_phase_change(new_phase: Phase) -> void:
|
||||
match new_phase:
|
||||
Phase.AIM:
|
||||
hud_state.travel("visible")
|
||||
if not arrow.visible:
|
||||
arrow_animation.play("show")
|
||||
camera.make_current()
|
||||
|
@ -266,6 +272,7 @@ func _on_phase_change(new_phase: Phase) -> void:
|
|||
if not driving_range:
|
||||
shot_animation.play("shoot")
|
||||
arrow_animation.play("hide")
|
||||
hud_state.travel("hidden")
|
||||
|
||||
take_shot()
|
||||
Phase.FINISHED:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=25 format=3 uid="uid://cy7t2tc4y3b4"]
|
||||
[gd_scene load_steps=35 format=3 uid="uid://cy7t2tc4y3b4"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/player/shot_setup/shot_setup.gd" id="1_r6ei4"]
|
||||
[ext_resource type="PackedScene" uid="uid://dfttci386ohip" path="res://src/player/physics_ball/physics_ball.tscn" id="2_1i5j5"]
|
||||
|
@ -403,6 +403,85 @@ _data = {
|
|||
"fill": SubResource("Animation_uo6s7")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_dt1yq"]
|
||||
resource_name = "hide"
|
||||
length = 0.4
|
||||
step = 0.02
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("%ClubSelector:rotation")
|
||||
tracks/0/interp = 4
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.4),
|
||||
"transitions": PackedFloat32Array(1.618, 1.618, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 0.0872665, -1.5708]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3cn2c"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("%ClubSelector:rotation")
|
||||
tracks/0/interp = 4
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_0maif"]
|
||||
resource_name = "show"
|
||||
length = 0.4
|
||||
step = 0.02
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("%ClubSelector:rotation")
|
||||
tracks/0/interp = 4
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.34, 0.4),
|
||||
"transitions": PackedFloat32Array(1.618, 1.618, 1),
|
||||
"update": 0,
|
||||
"values": [-1.5708, 0.0872665, 0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_c3i4w"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_3cn2c"),
|
||||
"hide": SubResource("Animation_dt1yq"),
|
||||
"show": SubResource("Animation_0maif")
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8uxnp"]
|
||||
animation = &"hide"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_v05eu"]
|
||||
animation = &"show"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_28a4x"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_bj7v0"]
|
||||
switch_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_xpwgd"]
|
||||
switch_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_osrbp"]
|
||||
states/hidden/node = SubResource("AnimationNodeAnimation_8uxnp")
|
||||
states/hidden/position = Vector2(592, 100)
|
||||
states/visible/node = SubResource("AnimationNodeAnimation_v05eu")
|
||||
states/visible/position = Vector2(364, 100)
|
||||
transitions = ["Start", "visible", SubResource("AnimationNodeStateMachineTransition_28a4x"), "visible", "hidden", SubResource("AnimationNodeStateMachineTransition_bj7v0"), "hidden", "visible", SubResource("AnimationNodeStateMachineTransition_xpwgd")]
|
||||
graph_offset = Vector2(-309, -132)
|
||||
|
||||
[node name="ShotSetup" type="Node3D"]
|
||||
script = ExtResource("1_r6ei4")
|
||||
|
||||
|
@ -643,7 +722,17 @@ offset_right = 50.0
|
|||
offset_bottom = 50.0
|
||||
grow_horizontal = 1
|
||||
grow_vertical = 1
|
||||
pivot_offset = Vector2(-200, 0)
|
||||
|
||||
[node name="HUDAnimation" type="AnimationPlayer" parent="ShotUI"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_c3i4w")
|
||||
}
|
||||
|
||||
[node name="HUDStateMachine" type="AnimationTree" parent="ShotUI"]
|
||||
unique_name_in_owner = true
|
||||
root_node = NodePath("%HUDStateMachine/..")
|
||||
tree_root = SubResource("AnimationNodeStateMachine_osrbp")
|
||||
anim_player = NodePath("../HUDAnimation")
|
||||
|
||||
[connection signal="sleeping_state_changed" from="BallPoint/PhysicsBall" to="." method="_on_physics_ball_sleeping_state_changed"]
|
||||
|
|
Loading…
Reference in New Issue