[gd_scene load_steps=10 format=3 uid="uid://n1wrym3osxb8"]

[ext_resource type="PackedScene" uid="uid://bw3rjal5qlu0p" path="res://game/sabers/default/default_saber.tscn" id="1"]
[ext_resource type="Script" path="res://game/LightSaber.gd" id="2"]
[ext_resource type="PackedScene" uid="uid://chkilqvhyqt37" path="res://game/scripts/SwingableRayCast/SwingableRayCast.tscn" id="3"]

[sub_resource type="Animation" id="2"]
resource_name = "Hide"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("RayCast3D:target_position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector3(0, 1.26, 0), Vector3(0, 0, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("SwingableRayCast:target_position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector3(0, 1.26, 0), Vector3(0, 0, 0)]
}

[sub_resource type="Animation" id="3"]
resource_name = "QuickHide"
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
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("RayCast3D:target_position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector3(0, 0, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("SwingableRayCast:target_position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector3(0, 0, 0)]
}

[sub_resource type="Animation" id="Animation_solq6"]
length = 0.001

[sub_resource type="Animation" id="4"]
length = 1.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("RayCast3D:target_position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector3(0, 0, 0), Vector3(0, 1.26, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("SwingableRayCast:target_position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector3(0, 0, 0), Vector3(0, 1.26, 0)]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_l1r6j"]
_data = {
"Hide": SubResource("2"),
"QuickHide": SubResource("3"),
"RESET": SubResource("Animation_solq6"),
"Show": SubResource("4")
}

[sub_resource type="CylinderShape3D" id="CylinderShape3D_38d8l"]
height = 1.248
radius = 0.021

[node name="LightSaber" type="Area3D" groups=["lightsaber"]]
collision_layer = 0
script = ExtResource("2")
offset_pos = Vector3(0, 0, 0.023)
offset_rot = Vector3(-48.297, 0, 0)

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_l1r6j")
}

[node name="RayCast3D" type="RayCast3D" parent="."]
target_position = Vector3(0, 1.26, 0)
collision_mask = 8

[node name="SwingableRayCast" parent="." instance=ExtResource("3")]
exclude_parent = false
target_position = Vector3(0, 1.4, 0)
collide_with_areas = true
collide_with_bodies = false

[node name="saber_holder" type="Node3D" parent="."]

[node name="default_saber" parent="saber_holder" instance=ExtResource("1")]

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.651, 0)
shape = SubResource("CylinderShape3D_38d8l")

[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]
[connection signal="animation_started" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_started"]
[connection signal="area_collided" from="SwingableRayCast" to="." method="_handle_area_collided"]
