wave-survival/project/objects/enemies/enemy_rifleman.tscn

130 lines
6.2 KiB
Text

[gd_scene format=3 uid="uid://qx1ywrcl3gf6"]
[ext_resource type="PackedScene" uid="uid://bcy5dxdvkkq4y" path="res://assets/models/enemies/rifleman.blend" id="1_l222e"]
[ext_resource type="PackedScene" uid="uid://clbq43giddldc" path="res://objects/effects/blood_effect.tscn" id="2_pe2i3"]
[sub_resource type="GDScript" id="GDScript_l222e"]
resource_name = "EnemyRiflemanScript"
script/source = "extends EnemyRifleman
@export var difficulty_weight : float = 0.1
var is_dead := false
func on_death() -> void:
%StateMachine.switch_to_state(null)
%NavigationAgent3D.process_mode = Node.PROCESS_MODE_DISABLED
$CollisionShape3D.disabled = true
set_movement_direction(Vector2())
func _on_health_status_death() -> void:
$rifleman/AnimationPlayer.play(\"death\")
get_unit().region.raise_difficulty(difficulty_weight)
on_death.call_deferred()
is_dead = true
func _enter_tree() -> void:
if is_dead and $rifleman/AnimationPlayer.current_animation != \"death\":
$rifleman/AnimationPlayer.play.call_deferred(\"death\")
$rifleman/AnimationPlayer.advance.call_deferred(INF)
elif is_dead:
$rifleman/AnimationPlayer.play.call_deferred(\"death\")
"
[sub_resource type="BoxShape3D" id="BoxShape3D_0dxtm"]
size = Vector3(0.2939453, 0.86813354, 0.18945313)
[sub_resource type="BoxShape3D" id="BoxShape3D_avqge"]
size = Vector3(0.34545898, 0.65130615, 0.17871094)
[sub_resource type="BoxShape3D" id="BoxShape3D_pe2i3"]
size = Vector3(0.24902344, 0.42858887, 0.2619629)
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_pe2i3"]
radius = 0.087402344
height = 1.918457
[node name="EnemyRifleman" type="EnemyRifleman" unique_id=1089821759]
collision_layer = 33
collision_mask = 33
slide_on_ceiling = false
wall_min_slide_angle = 0.0
script = SubResource("GDScript_l222e")
difficulty_weight = 0.3
[node name="rifleman" parent="." unique_id=1974372899 instance=ExtResource("1_l222e")]
[node name="Hitbox" type="Hitbox" parent="rifleman/Character/Skeleton3D" parent_id_path=PackedInt32Array(1974372899, 1661246372) index="2" unique_id=1055859191 node_paths=PackedStringArray("health")]
transform = Transform3D(1, 2.1910389e-16, -2.2202524e-16, -2.2202514e-16, 0.9999124, -0.013243958, 2.1910394e-16, 0.01324396, 0.9999123, 6.209e-17, 0.097789526, 0.004007945)
collision_layer = 6
collision_mask = 0
monitoring = false
health = NodePath("../../../../HealthStatus")
impact_effect = ExtResource("2_pe2i3")
[node name="CollisionShape3D" type="CollisionShape3D" parent="rifleman/Character/Skeleton3D/Hitbox" unique_id=769458773]
transform = Transform3D(1.0000024, -1.4661055e-09, 2.3283064e-09, 6.548362e-11, 0.99992234, 0.013243848, 4.0745363e-09, -0.013243998, 0.9999193, -4.6134344e-10, 0.3361803, -0.0015157582)
shape = SubResource("BoxShape3D_0dxtm")
debug_color = Color(0, 0.64368725, 0.30114147, 0.41960785)
[node name="SpineAttach" type="BoneAttachment3D" parent="rifleman/Character/Skeleton3D" parent_id_path=PackedInt32Array(1974372899, 1661246372) index="3" unique_id=1906380733]
transform = Transform3D(1, -2.2202518e-16, 2.1910394e-16, 2.1910388e-16, 0.9999122, 0.013243958, -2.220252e-16, -0.01324396, 0.99991226, -4.1256417e-17, 1.1546816, -0.0027124756)
bone_name = "spine.002"
bone_idx = 6
[node name="Hitbox2" type="Hitbox" parent="rifleman/Character/Skeleton3D/SpineAttach" unique_id=1699960919 node_paths=PackedStringArray("health")]
transform = Transform3D(1, 2.1910389e-16, -2.2202524e-16, -2.2202514e-16, 0.9999124, -0.013243958, 2.1910394e-16, 0.01324396, 0.9999123, -2.1234107e-16, -1.1546164, -0.012580322)
collision_layer = 4
collision_mask = 0
monitoring = false
health = NodePath("../../../../../HealthStatus")
impact_effect = ExtResource("2_pe2i3")
[node name="CollisionShape3D" type="CollisionShape3D" parent="rifleman/Character/Skeleton3D/SpineAttach/Hitbox2" unique_id=184983678]
transform = Transform3D(1.0000024, -1.4661055e-09, 2.3283064e-09, 6.548362e-11, 0.9999224, 0.013243848, 4.0745363e-09, -0.013244033, 0.9999193, -2.8989222e-10, 1.1922497, -0.0074829045)
shape = SubResource("BoxShape3D_avqge")
debug_color = Color(0, 0.64368725, 0.30114147, 0.41960785)
[node name="HeadAttach" type="BoneAttachment3D" parent="rifleman/Character/Skeleton3D" parent_id_path=PackedInt32Array(1974372899, 1661246372) index="4" unique_id=174540097]
transform = Transform3D(1, -2.2186816e-16, 2.1319254e-16, 2.1319254e-16, 0.99920464, 0.039866533, -2.2186818e-16, -0.039866537, 0.99920475, -1.3069549e-16, 1.5574794, -0.004068733)
bone_name = "Neck"
bone_idx = 8
[node name="Hitbox2" type="Hitbox" parent="rifleman/Character/Skeleton3D/HeadAttach" unique_id=1868610059 node_paths=PackedStringArray("health")]
transform = Transform3D(1, 2.1910389e-16, -2.2202524e-16, -2.2202514e-16, 0.9999124, -0.013243958, 2.1910394e-16, 0.01324396, 0.9999123, -2.1234107e-16, -1.1546164, -0.012580322)
collision_layer = 4
collision_mask = 0
monitoring = false
health = NodePath("../../../../../HealthStatus")
damage_modifier = 4.0
impact_effect = ExtResource("2_pe2i3")
[node name="CollisionShape3D" type="CollisionShape3D" parent="rifleman/Character/Skeleton3D/HeadAttach/Hitbox2" unique_id=393334687]
transform = Transform3D(1.0000024, -1.4661055e-09, 2.3283064e-09, 6.548362e-11, 0.9999224, 0.013243848, 4.0745363e-09, -0.013244033, 0.9999193, -4.656613e-10, 1.3035285, -0.014328403)
shape = SubResource("BoxShape3D_pe2i3")
debug_color = Color(0, 0.64368725, 0.30114147, 0.41960785)
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1155449479]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9618902, 0)
shape = SubResource("CapsuleShape3D_pe2i3")
[node name="StateMachine" type="StateMachine" parent="." unique_id=386183876]
unique_name_in_owner = true
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="." unique_id=440954670]
unique_name_in_owner = true
avoidance_enabled = true
neighbor_distance = 10.0
time_horizon_agents = 0.7
[node name="PlayerDetector" type="PlayerDetector" parent="." unique_id=1321162569]
unique_name_in_owner = true
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0, 1.5103652, 0)
[node name="HealthStatus" type="HealthStatus" parent="." unique_id=976044289]
unique_name_in_owner = true
health = 2
[connection signal="death" from="HealthStatus" to="." method="_on_health_status_death"]
[editable path="rifleman"]