generated from krampus/template-godot4
Distinct animation players for different HUD alerts
This commit is contained in:
parent
217224f9c3
commit
de6606fdcf
@ -2,7 +2,9 @@ class_name PlayerHUD extends Control
|
||||
|
||||
@onready var interact_hud: InteractHUD = %InteractHUD
|
||||
|
||||
@onready var alert_player: AnimationPlayer = %AlertPlayer
|
||||
@onready var grunk_alert_player: AnimationPlayer = %GrunkAlertPlayer
|
||||
@onready var tank_alert_player: AnimationPlayer = %TankAlertPlayer
|
||||
@onready var alert_clear_player: AnimationPlayer = %AlertClearPlayer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@ -15,12 +17,12 @@ func select_interactive(prop: Interactive) -> void:
|
||||
|
||||
|
||||
func _on_raise_alert(_new_value: int) -> void:
|
||||
alert_player.play("grunk_alert")
|
||||
grunk_alert_player.play("grunk_alert")
|
||||
|
||||
|
||||
func play_tank_full_alert() -> void:
|
||||
alert_player.play("tank_full_alert")
|
||||
tank_alert_player.play("tank_full_alert")
|
||||
|
||||
|
||||
func _on_clear_alert() -> void:
|
||||
alert_player.play("alert_clear")
|
||||
alert_clear_player.play("alert_clear")
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://dq1x21tq06dud"]
|
||||
[gd_scene load_steps=17 format=3 uid="uid://dq1x21tq06dud"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://b07fevr214mmr" path="res://src/ui/hud/hud_theme.tres" id="1_lirk3"]
|
||||
[ext_resource type="Script" uid="uid://lrsv0185bfu" path="res://src/ui/hud/player_hud.gd" id="2_j6lpx"]
|
||||
@ -8,12 +8,50 @@
|
||||
[ext_resource type="Script" uid="uid://cjs2fen6jo0g0" path="res://src/ui/rumbler.gd" id="4_ud8na"]
|
||||
[ext_resource type="FontFile" uid="uid://oq8ue2qrfijg" path="res://assets/fonts/Silkscreen/Silkscreen-Regular.ttf" id="7_iwjh7"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8np55"]
|
||||
resource_name = "tank_full_alert"
|
||||
length = 3.6
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("TankAlert:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.6, 1.2, 1.8, 2.4, 3, 3.6),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_iwjh7"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("TankAlert:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_c1hvd"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_iwjh7"),
|
||||
&"tank_full_alert": SubResource("Animation_8np55")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_n6jee"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("GrunkAlertWarning:modulate")
|
||||
tracks/0/path = NodePath("GrunkAlert/GrunkAlertWarning:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
@ -25,7 +63,7 @@ tracks/0/keys = {
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Rumbler/GrunkAlert2:modulate")
|
||||
tracks/1/path = NodePath("GrunkAlert/Rumbler/GrunkAlert2:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
@ -34,65 +72,40 @@ tracks/1/keys = {
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("TankAlert:modulate")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
|
||||
[sub_resource type="Animation" id="Animation_5be8f"]
|
||||
resource_name = "grunk_alert"
|
||||
length = 4.6
|
||||
step = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("GrunkAlert/GrunkAlertWarning:modulate")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("AlertClearMessage:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("GrunkAlert/Rumbler/GrunkAlert2:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 1.6, 2.2, 2.8, 3.4, 4.00479, 4.6),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("AlertClearMessage/Line1:visible_ratio")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath("AlertClearMessage/RichTextLabel:visible_ratio")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/6/type = "value"
|
||||
tracks/6/imported = false
|
||||
tracks/6/enabled = true
|
||||
tracks/6/path = NodePath("AlertClearMessage:modulate")
|
||||
tracks/6/interp = 1
|
||||
tracks/6/loop_wrap = true
|
||||
tracks/6/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ud8na"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_n6jee"),
|
||||
&"grunk_alert": SubResource("Animation_5be8f")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_65kmv"]
|
||||
@ -147,58 +160,61 @@ tracks/3/keys = {
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_5be8f"]
|
||||
resource_name = "grunk_alert"
|
||||
length = 4.6
|
||||
step = 0.2
|
||||
[sub_resource type="Animation" id="Animation_c1hvd"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("GrunkAlertWarning:modulate")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/path = NodePath("AlertClearMessage:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Rumbler/GrunkAlert2:modulate")
|
||||
tracks/1/path = NodePath("AlertClearMessage:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 1.6, 2.2, 2.8, 3.4, 4.00479, 4.6),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ud8na"]
|
||||
resource_name = "tank_full_alert"
|
||||
length = 3.6
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("TankAlert:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.6, 1.2, 1.8, 2.4, 3, 3.6),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("AlertClearMessage/Line1:visible_ratio")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("AlertClearMessage/RichTextLabel:visible_ratio")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ud8na"]
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_bu2tv"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_n6jee"),
|
||||
&"alert_clear": SubResource("Animation_65kmv"),
|
||||
&"grunk_alert": SubResource("Animation_5be8f"),
|
||||
&"tank_full_alert": SubResource("Animation_ud8na")
|
||||
&"RESET": SubResource("Animation_c1hvd"),
|
||||
&"alert_clear": SubResource("Animation_65kmv")
|
||||
}
|
||||
|
||||
[node name="PlayerHUD" type="Control"]
|
||||
@ -303,58 +319,70 @@ theme_type_variation = &"AlertLabel"
|
||||
text = "HUD_TANK_WARNING"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="GrunkAlertWarning" type="HBoxContainer" parent="AlertHUD"]
|
||||
[node name="TankAlertPlayer" type="AnimationPlayer" parent="AlertHUD/TankAlert"]
|
||||
unique_name_in_owner = true
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_c1hvd")
|
||||
}
|
||||
|
||||
[node name="GrunkAlert" type="Control" parent="AlertHUD"]
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="GrunkAlertWarning" type="HBoxContainer" parent="AlertHUD/GrunkAlert"]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
layout_mode = 1
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -264.0
|
||||
offset_right = 264.0
|
||||
offset_left = 20.0
|
||||
offset_right = 740.0
|
||||
offset_bottom = 82.0
|
||||
grow_horizontal = 2
|
||||
theme_type_variation = &"AlertLabel"
|
||||
theme_override_constants/separation = 32
|
||||
alignment = 1
|
||||
|
||||
[node name="Icon" type="Label" parent="AlertHUD/GrunkAlertWarning"]
|
||||
[node name="Icon" type="Label" parent="AlertHUD/GrunkAlert/GrunkAlertWarning"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"AlertLabel"
|
||||
theme_override_fonts/font = ExtResource("4_2q5it")
|
||||
text = ""
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Warning" type="Label" parent="AlertHUD/GrunkAlertWarning"]
|
||||
[node name="Warning" type="Label" parent="AlertHUD/GrunkAlert/GrunkAlertWarning"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"AlertLabel"
|
||||
text = "HUD_WARNING"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Icon2" type="Label" parent="AlertHUD/GrunkAlertWarning"]
|
||||
[node name="Icon2" type="Label" parent="AlertHUD/GrunkAlert/GrunkAlertWarning"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"AlertLabel"
|
||||
theme_override_fonts/font = ExtResource("4_2q5it")
|
||||
text = ""
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Rumbler" type="Control" parent="AlertHUD"]
|
||||
[node name="Rumbler" type="Control" parent="AlertHUD/GrunkAlert"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -398.595
|
||||
offset_top = -300.206
|
||||
offset_right = -398.595
|
||||
offset_bottom = -300.206
|
||||
offset_left = -19.9658
|
||||
offset_top = -20.8966
|
||||
offset_right = -19.9658
|
||||
offset_bottom = -20.8966
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("4_ud8na")
|
||||
intensity = 2.0
|
||||
metadata/_custom_type_script = "uid://cjs2fen6jo0g0"
|
||||
|
||||
[node name="GrunkAlert2" type="Control" parent="AlertHUD/Rumbler"]
|
||||
[node name="GrunkAlert2" type="Control" parent="AlertHUD/GrunkAlert/Rumbler"]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
layout_mode = 1
|
||||
anchors_preset = 5
|
||||
@ -367,7 +395,7 @@ grow_horizontal = 2
|
||||
mouse_filter = 2
|
||||
theme_type_variation = &"AlertLabel"
|
||||
|
||||
[node name="AlertLine1" type="Label" parent="AlertHUD/Rumbler/GrunkAlert2"]
|
||||
[node name="AlertLine1" type="Label" parent="AlertHUD/GrunkAlert/Rumbler/GrunkAlert2"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
@ -388,7 +416,7 @@ theme_override_font_sizes/font_size = 666
|
||||
text = "! GRUNK ALERT !"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="AlertLine2" type="Label" parent="AlertHUD/Rumbler/GrunkAlert2"]
|
||||
[node name="AlertLine2" type="Label" parent="AlertHUD/GrunkAlert/Rumbler/GrunkAlert2"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
@ -405,8 +433,16 @@ theme_type_variation = &"AlertLabel"
|
||||
text = "HUD_ALERT_MSG"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="GrunkAlertPlayer" type="AnimationPlayer" parent="AlertHUD/GrunkAlert"]
|
||||
unique_name_in_owner = true
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_ud8na")
|
||||
}
|
||||
|
||||
[node name="AlertClearMessage" type="VBoxContainer" parent="AlertHUD"]
|
||||
visible = false
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
layout_mode = 1
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
@ -440,8 +476,9 @@ visible_characters = 0
|
||||
visible_characters_behavior = 1
|
||||
visible_ratio = 0.0
|
||||
|
||||
[node name="AlertPlayer" type="AnimationPlayer" parent="AlertHUD"]
|
||||
[node name="AlertClearPlayer" type="AnimationPlayer" parent="AlertHUD/AlertClearMessage"]
|
||||
unique_name_in_owner = true
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_ud8na")
|
||||
&"": SubResource("AnimationLibrary_bu2tv")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user