fix animation inconsistent root nodes
parent
763b5e027e
commit
1bd258dbae
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -123,7 +123,7 @@ public partial class Character : CharacterBody2D, IFaction
|
|||
|
||||
if (StunTime > 0 && !StunAnimation.IsPlaying())
|
||||
{
|
||||
StunAnimation.Play("stun");
|
||||
StunAnimation.TryPlayAny("stun", "npc_stun/stun");
|
||||
}
|
||||
else if (StunTime < 0 && StunAnimation.IsPlaying())
|
||||
{
|
||||
|
@ -177,9 +177,9 @@ public partial class Character : CharacterBody2D, IFaction
|
|||
/// </summary>
|
||||
public virtual void Die()
|
||||
{
|
||||
if (HurtAnimation.HasAnimation("death"))
|
||||
if (HurtAnimation.TryPlayAny(out var name, "death", "npc_hurt/death"))
|
||||
{
|
||||
HurtAnimation.Play("death");
|
||||
HurtAnimation.Play(name);
|
||||
HurtAnimation.AnimationFinished += (StringName name) =>
|
||||
QueueFree();
|
||||
}
|
||||
|
@ -342,11 +342,8 @@ public partial class Character : CharacterBody2D, IFaction
|
|||
if (HurtAnimation is not null && Health > 0)
|
||||
{
|
||||
HurtAnimation.Stop();
|
||||
HurtAnimation.Play("hurt");
|
||||
if (HurtAnimation.HasAnimation("hurt_flash"))
|
||||
{
|
||||
HurtAnimation.Queue("hurt_flash");
|
||||
}
|
||||
HurtAnimation.TryPlayAny("hurt", "npc_hurt/hurt");
|
||||
HurtAnimation.TryQueue("hurt_flash");
|
||||
}
|
||||
|
||||
if (this.GetNode("Effects/HurtSound") is AudioStreamPlayer2D sound)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=41 format=3 uid="uid://dhamcei7tfta8"]
|
||||
[gd_scene load_steps=36 format=3 uid="uid://dhamcei7tfta8"]
|
||||
|
||||
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="1_msit5"]
|
||||
[ext_resource type="Script" path="res://Characters/Enemy.cs" id="2_pkari"]
|
||||
|
@ -9,7 +9,8 @@
|
|||
[ext_resource type="Script" path="res://State/Thinker/CenturionAttackState.cs" id="7_n2slg"]
|
||||
[ext_resource type="Script" path="res://State/Thinker/IdleState.cs" id="8_5neew"]
|
||||
[ext_resource type="Script" path="res://Utils/AnimationManager.cs" id="9_fgnr2"]
|
||||
[ext_resource type="Animation" uid="uid://8e8r3y1imvsx" path="res://Assets/Animations/stun.res" id="10_1erll"]
|
||||
[ext_resource type="AnimationLibrary" uid="uid://xs6g84fkepjr" path="res://Assets/Animations/npc_hurt.res" id="10_bbwbd"]
|
||||
[ext_resource type="AnimationLibrary" uid="uid://f1aqhnxndybx" path="res://Assets/Animations/npc_stun.res" id="11_a0f8a"]
|
||||
[ext_resource type="Material" uid="uid://bat28samf7ukd" path="res://Assets/Sprites/Particles/NPCDamageProcessMaterial.tres" id="11_p7yev"]
|
||||
[ext_resource type="Texture2D" uid="uid://bd8l8kafb42dt" path="res://Assets/Sprites/Particles/circle.png" id="12_t3nnt"]
|
||||
[ext_resource type="Material" uid="uid://2tsvsp45elru" path="res://Assets/Sprites/Particles/NPCDeathParticles.tres" id="13_nm3wd"]
|
||||
|
@ -66,7 +67,7 @@ loop_mode = 1
|
|||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
|
||||
tracks/0/path = NodePath("./Sprites/Node2D/Character:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
|
@ -92,158 +93,20 @@ _data = {
|
|||
"RESET": SubResource("Animation_adxyh")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_k6l16"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:material:shader_parameter/intensity")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:material:shader_parameter/alpha_modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [1.0]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("%Effects/DeathParticles:emitting")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("%Effects/HurtParticles:emitting")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_lhc4c"]
|
||||
resource_name = "death"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("%Effects/DeathParticles:emitting")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:material:shader_parameter/alpha_modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [1.0, 0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_0vgmg"]
|
||||
resource_local_to_scene = true
|
||||
resource_name = "hurt"
|
||||
length = 0.2
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:material:shader_parameter/intensity")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.05, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(4, 4, 4, 4),
|
||||
"update": 0,
|
||||
"values": [1.0, 0.0, 1.0, 0.0]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("%Effects/HurtParticles:emitting")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/2/type = "method"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("%Effects/HurtParticles")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.1),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"restart"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_rc55s"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_k6l16"),
|
||||
"death": SubResource("Animation_lhc4c"),
|
||||
"hurt": SubResource("Animation_0vgmg")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_7j54f"]
|
||||
length = 0.001
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_kks2p"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_7j54f"),
|
||||
"stun": ExtResource("10_1erll")
|
||||
}
|
||||
|
||||
[sub_resource type="CanvasTexture" id="CanvasTexture_pited"]
|
||||
diffuse_texture = ExtResource("14_o5rd3")
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_b2o0f"]
|
||||
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_iyaih"]
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_tfqqu"]
|
||||
gradient = SubResource("Gradient_b2o0f")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_30p4b"]
|
||||
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.2, 1), 0.0, 0.0, 0, 0, Vector2(1, 0.5), 0.0, 0.0, 0, 0]
|
||||
point_count = 3
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_5uulw"]
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_pcpms"]
|
||||
curve = SubResource("Curve_30p4b")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_qdhau"]
|
||||
|
@ -262,9 +125,9 @@ tangential_accel_min = 8.0
|
|||
tangential_accel_max = 8.0
|
||||
scale_min = 0.13
|
||||
scale_max = 0.25
|
||||
scale_curve = SubResource("CurveTexture_5uulw")
|
||||
scale_curve = SubResource("CurveTexture_pcpms")
|
||||
color = Color(1, 0, 0, 1)
|
||||
color_ramp = SubResource("GradientTexture1D_iyaih")
|
||||
color_ramp = SubResource("GradientTexture1D_tfqqu")
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bfqew"]
|
||||
size = Vector2(12, 8)
|
||||
|
@ -338,11 +201,13 @@ debug_enabled = true
|
|||
script = ExtResource("9_fgnr2")
|
||||
|
||||
[node name="Movement" type="AnimationPlayer" parent="Animations"]
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_uqsue")
|
||||
}
|
||||
|
||||
[node name="Attack" type="AnimationPlayer" parent="Animations"]
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_sxq14")
|
||||
}
|
||||
|
@ -350,12 +215,13 @@ libraries = {
|
|||
[node name="Hurt" type="AnimationPlayer" parent="Animations"]
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_rc55s")
|
||||
"": ExtResource("10_bbwbd")
|
||||
}
|
||||
|
||||
[node name="Stun" type="AnimationPlayer" parent="Animations"]
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_kks2p")
|
||||
"": ExtResource("11_a0f8a")
|
||||
}
|
||||
|
||||
[node name="Effects" type="Node2D" parent="."]
|
||||
|
@ -403,6 +269,7 @@ use_parent_material = true
|
|||
texture = ExtResource("16_6uxxp")
|
||||
offset = Vector2(0, -12)
|
||||
hframes = 7
|
||||
frame = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -4)
|
||||
|
|
|
@ -51,7 +51,7 @@ loop_mode = 1
|
|||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
|
||||
tracks/0/path = NodePath("%Sprites/Node2D/Character:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
|
@ -68,7 +68,7 @@ loop_mode = 1
|
|||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
|
||||
tracks/0/path = NodePath("%Sprites/Node2D/Character:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
|
@ -351,11 +351,13 @@ target_desired_distance = 16.0
|
|||
script = ExtResource("9_ssmee")
|
||||
|
||||
[node name="Movement" type="AnimationPlayer" parent="Animations"]
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_uqsue")
|
||||
}
|
||||
|
||||
[node name="Attack" type="AnimationPlayer" parent="Animations"]
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_sxq14")
|
||||
}
|
||||
|
@ -367,6 +369,7 @@ libraries = {
|
|||
}
|
||||
|
||||
[node name="Stun" type="AnimationPlayer" parent="Animations"]
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_kks2p")
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=26 format=3 uid="uid://bf55wbq7m1gpp"]
|
||||
[gd_scene load_steps=19 format=3 uid="uid://bf55wbq7m1gpp"]
|
||||
|
||||
[ext_resource type="Script" path="res://Characters/Enemy.cs" id="1_2yopk"]
|
||||
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="1_fx1w5"]
|
||||
|
@ -6,8 +6,10 @@
|
|||
[ext_resource type="Script" path="res://State/Character/CharacterStateMachine.cs" id="4_424ux"]
|
||||
[ext_resource type="Script" path="res://State/Character/NPCIdleState.cs" id="5_tn4cf"]
|
||||
[ext_resource type="Script" path="res://State/Character/NPCMoveState.cs" id="6_73mr6"]
|
||||
[ext_resource type="Script" path="res://State/Thinker/ThinkerStateMachine.cs" id="6_and4s"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="6_jo0cg"]
|
||||
[ext_resource type="Script" path="res://Items/Inventory.cs" id="7_43gq8"]
|
||||
[ext_resource type="Script" path="res://State/Thinker/AttackState.cs" id="7_bp1d0"]
|
||||
[ext_resource type="PackedScene" uid="uid://dvqap2uhcah63" path="res://Items/Weapons/Sword.tscn" id="8_s3c8r"]
|
||||
[ext_resource type="AudioStream" uid="uid://njun3e6v4854" path="res://Assets/Sounds/hurt.wav" id="10_n1e64"]
|
||||
|
||||
|
@ -55,91 +57,22 @@ _data = {
|
|||
"hurt": SubResource("Animation_dxevc")
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_55yt4"]
|
||||
atlas = ExtResource("3_ocaae")
|
||||
region = Rect2(0, 0, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xa1bi"]
|
||||
atlas = ExtResource("3_ocaae")
|
||||
region = Rect2(24, 0, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hiodl"]
|
||||
atlas = ExtResource("3_ocaae")
|
||||
region = Rect2(48, 0, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tok7d"]
|
||||
atlas = ExtResource("3_ocaae")
|
||||
region = Rect2(72, 0, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dp8x6"]
|
||||
atlas = ExtResource("3_ocaae")
|
||||
region = Rect2(96, 0, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sglor"]
|
||||
atlas = ExtResource("3_ocaae")
|
||||
region = Rect2(120, 0, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gb41o"]
|
||||
atlas = ExtResource("3_ocaae")
|
||||
region = Rect2(144, 0, 24, 24)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bx6qq"]
|
||||
atlas = ExtResource("3_ocaae")
|
||||
region = Rect2(168, 0, 24, 24)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_6pejo"]
|
||||
resource_local_to_scene = true
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_55yt4")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xa1bi")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hiodl")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_tok7d")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dp8x6")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_sglor")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gb41o")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_bx6qq")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"move",
|
||||
"speed": 12.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_uict5"]
|
||||
size = Vector2(16, 8)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8lxmf"]
|
||||
size = Vector2(16, 18)
|
||||
|
||||
[node name="ExampleEnemy" type="CharacterBody2D" node_paths=PackedStringArray("Sprite", "Inventory", "StateMachine", "Hurtbox")]
|
||||
[node name="ExampleEnemy" type="CharacterBody2D" node_paths=PackedStringArray("ThinkerStateMachine", "Sprite", "Inventory", "StateMachine", "Hurtbox")]
|
||||
y_sort_enabled = true
|
||||
texture_filter = 3
|
||||
material = SubResource("ShaderMaterial_ms3xg")
|
||||
collision_layer = 10
|
||||
collision_mask = 17
|
||||
script = ExtResource("1_2yopk")
|
||||
ThinkerStateMachine = NodePath("ThinkerStateMachine")
|
||||
Health = 50.0
|
||||
Sprite = NodePath("Sprite")
|
||||
Sprite = NodePath("Sprites/Node2D/Character")
|
||||
Inventory = NodePath("Inventory")
|
||||
StateMachine = NodePath("StateMachine")
|
||||
Hurtbox = NodePath("Hurtbox")
|
||||
|
@ -160,6 +93,14 @@ script = ExtResource("6_73mr6")
|
|||
IdleState = NodePath("../Idle")
|
||||
Character = NodePath("../..")
|
||||
|
||||
[node name="ThinkerStateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState")]
|
||||
script = ExtResource("6_and4s")
|
||||
InitialState = NodePath("Attack")
|
||||
|
||||
[node name="Attack" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("NPC")]
|
||||
script = ExtResource("7_bp1d0")
|
||||
NPC = NodePath("../..")
|
||||
|
||||
[node name="Animations" type="Node" parent="."]
|
||||
|
||||
[node name="HurtAnimation" type="AnimationPlayer" parent="Animations"]
|
||||
|
@ -168,11 +109,21 @@ libraries = {
|
|||
"": SubResource("AnimationLibrary_xe5eq")
|
||||
}
|
||||
|
||||
[node name="Sprite" type="AnimatedSprite2D" parent="."]
|
||||
[node name="Sprites" type="Node2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
y_sort_enabled = true
|
||||
use_parent_material = true
|
||||
position = Vector2(0, -4)
|
||||
sprite_frames = SubResource("SpriteFrames_6pejo")
|
||||
animation = &"move"
|
||||
position = Vector2(-0.5, 0)
|
||||
|
||||
[node name="Node2D" type="Node2D" parent="Sprites"]
|
||||
use_parent_material = true
|
||||
|
||||
[node name="Character" type="Sprite2D" parent="Sprites/Node2D"]
|
||||
use_parent_material = true
|
||||
position = Vector2(0, -8)
|
||||
texture = ExtResource("3_ocaae")
|
||||
offset = Vector2(0, -4)
|
||||
hframes = 46
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, 4)
|
||||
|
@ -188,6 +139,7 @@ shape = SubResource("RectangleShape2D_8lxmf")
|
|||
|
||||
[node name="Inventory" type="Node2D" parent="."]
|
||||
y_sort_enabled = true
|
||||
position = Vector2(0, -4)
|
||||
script = ExtResource("7_43gq8")
|
||||
|
||||
[node name="Sword" parent="Inventory" instance=ExtResource("8_s3c8r")]
|
||||
|
|
|
@ -140,7 +140,7 @@ loop_mode = 1
|
|||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
|
||||
tracks/0/path = NodePath("%Sprites/Node2D/Character:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
|
@ -152,7 +152,7 @@ tracks/0/keys = {
|
|||
tracks/1/type = "method"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("..")
|
||||
tracks/1/path = NodePath(".")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
|
@ -174,7 +174,7 @@ step = 0.05
|
|||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("../Sprites/Node2D/Character:rotation")
|
||||
tracks/0/path = NodePath("%Sprites/Node2D/Character:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
|
@ -190,7 +190,7 @@ length = 0.2
|
|||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
|
||||
tracks/0/path = NodePath("%Sprites/Node2D/Character:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
|
@ -252,7 +252,7 @@ tracks/2/keys = {
|
|||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("../Sprites/CharacterEffects/Cast:visible")
|
||||
tracks/3/path = NodePath("%Sprites/CharacterEffects/Cast:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
|
@ -264,7 +264,7 @@ tracks/3/keys = {
|
|||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("../Sprites/CharacterEffects/Cast:frame")
|
||||
tracks/4/path = NodePath("%Sprites/CharacterEffects/Cast:frame")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
|
@ -309,7 +309,7 @@ tracks/1/keys = {
|
|||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("../Sprites/CharacterEffects/Cast:visible")
|
||||
tracks/2/path = NodePath("%Sprites/CharacterEffects/Cast:visible")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
|
@ -321,7 +321,7 @@ tracks/2/keys = {
|
|||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("../Sprites/CharacterEffects/Cast:frame")
|
||||
tracks/3/path = NodePath("%Sprites/CharacterEffects/Cast:frame")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
|
@ -670,11 +670,13 @@ unique_name_in_owner = true
|
|||
script = ExtResource("7_sdgvb")
|
||||
|
||||
[node name="Movement" type="AnimationPlayer" parent="Animations"]
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_0tohi")
|
||||
}
|
||||
|
||||
[node name="Attack" type="AnimationPlayer" parent="Animations"]
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_73mj7")
|
||||
}
|
||||
|
@ -686,6 +688,7 @@ libraries = {
|
|||
}
|
||||
|
||||
[node name="Stun" type="AnimationPlayer" parent="Animations"]
|
||||
root_node = NodePath("../..")
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_kks2p")
|
||||
}
|
||||
|
|
|
@ -14,6 +14,27 @@ public static class AnimationPlayerExtensions
|
|||
return hasAnimation;
|
||||
}
|
||||
|
||||
public static bool TryPlayAny(this AnimationPlayer player,
|
||||
params string[] names)
|
||||
{
|
||||
return player.TryPlayAny(out var _, names);
|
||||
}
|
||||
|
||||
public static bool TryPlayAny(this AnimationPlayer player,
|
||||
out string resultName, params string[] names)
|
||||
{
|
||||
foreach (string name in names)
|
||||
{
|
||||
if (player.TryPlay(name))
|
||||
{
|
||||
resultName = name;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
resultName = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool TryQueue(this AnimationPlayer player, string name)
|
||||
{
|
||||
var hasAnimation = player.HasAnimation(name);
|
||||
|
@ -23,4 +44,25 @@ public static class AnimationPlayerExtensions
|
|||
}
|
||||
return hasAnimation;
|
||||
}
|
||||
|
||||
public static bool TryQueueAny(this AnimationPlayer player,
|
||||
params string[] names)
|
||||
{
|
||||
return player.TryQueueAny(out var _, names);
|
||||
}
|
||||
|
||||
public static bool TryQueueAny(this AnimationPlayer player,
|
||||
out string resultName, params string[] names)
|
||||
{
|
||||
foreach (string name in names)
|
||||
{
|
||||
if (player.TryQueue(name))
|
||||
{
|
||||
resultName = name;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
resultName = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,14 +92,14 @@ public partial class AnimationManager : Node
|
|||
NodePath anim1Path = anim1.TrackGetPath(p1Track);
|
||||
NodePath anim1Prop = anim1Path.GetConcatenatedSubNames();
|
||||
NodePath anim1Name = anim1Path.GetConcatenatedNames();
|
||||
Node anim1Node = p1.GetParent().GetNode(anim1Name);
|
||||
Node anim1Node = p1.GetNode(p1.RootNode)?.GetNode(anim1Name);
|
||||
|
||||
for (int p2Track = 0; p2Track < anim2.GetTrackCount(); p2Track++)
|
||||
{
|
||||
NodePath anim2Path = anim2.TrackGetPath(p2Track);
|
||||
NodePath anim2Prop = anim2Path.GetConcatenatedSubNames();
|
||||
NodePath anim2Name = anim2Path.GetConcatenatedNames();
|
||||
Node anim2Node = p2.GetParent().GetNode(anim2Name);
|
||||
Node anim2Node = p2.GetNode(p2.RootNode)?.GetNode(anim2Name);
|
||||
|
||||
// check if they point to the same node and property
|
||||
if (anim1Node == anim2Node && anim1Prop == anim2Prop)
|
||||
|
|
Loading…
Reference in New Issue