[gd_scene load_steps=15 format=3 uid="uid://b3485f35xal4g"]

[ext_resource type="Script" uid="uid://dt3par53hpmaf" path="res://Scripts/Actors/Turret.cs" id="1_8kaj0"]
[ext_resource type="Texture2D" uid="uid://coai700bkqote" path="res://Sprites/Actors/Turret.png" id="2_epkv0"]
[ext_resource type="Script" uid="uid://ec2wfevxxgy8" path="res://Scripts/Components/CameraPlayerDetection.cs" id="3_qgpoq"]
[ext_resource type="PackedScene" uid="uid://bhl8u2plfk4yh" path="res://Scenes/Weapons/enemy_weapon_spread.tscn" id="4_dbwkh"]
[ext_resource type="Resource" uid="uid://cdfmedtgp2rcn" path="res://Resources/Weapons/EnemyWeapon.tres" id="5_3jfx2"]

[sub_resource type="AtlasTexture" id="AtlasTexture_5n5rh"]
atlas = ExtResource("2_epkv0")
region = Rect2(64, 0, 16, 16)

[sub_resource type="AtlasTexture" id="AtlasTexture_01kjk"]
atlas = ExtResource("2_epkv0")
region = Rect2(48, 0, 16, 16)

[sub_resource type="AtlasTexture" id="AtlasTexture_w7jtw"]
atlas = ExtResource("2_epkv0")
region = Rect2(32, 0, 16, 16)

[sub_resource type="AtlasTexture" id="AtlasTexture_er617"]
atlas = ExtResource("2_epkv0")
region = Rect2(16, 0, 16, 16)

[sub_resource type="AtlasTexture" id="AtlasTexture_sdq4o"]
atlas = ExtResource("2_epkv0")
region = Rect2(0, 0, 16, 16)

[sub_resource type="SpriteFrames" id="SpriteFrames_57tcf"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_5n5rh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_01kjk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_w7jtw")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_er617")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_sdq4o")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]

[sub_resource type="CircleShape2D" id="CircleShape2D_nkpag"]

[sub_resource type="CircleShape2D" id="CircleShape2D_gs7jc"]
radius = 85.0529

[sub_resource type="RectangleShape2D" id="RectangleShape2D_3bqsq"]
size = Vector2(8, 12)

[node name="Turret" type="CharacterBody2D" node_paths=PackedStringArray("EquippedWeapon", "_playerDetection")]
collision_layer = 16
collision_mask = 75
script = ExtResource("1_8kaj0")
WalkSpeed = 0.0
PlayerDisengageRange = 200.0
EquippedWeapon = NodePath("EnemyWeapon")
_playerDetection = NodePath("PlayerDetection")

[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_57tcf")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_nkpag")

[node name="PlayerDetection" type="Area2D" parent="."]
visible = false
collision_layer = 16
collision_mask = 2
script = ExtResource("3_qgpoq")
SweepSpeed = 10.0
SpritePath = NodePath("../AnimatedSprite2D")

[node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerDetection"]
shape = SubResource("CircleShape2D_gs7jc")

[node name="DamageHitbox" type="Area2D" parent="."]
collision_layer = 16
collision_mask = 9

[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageHitbox"]
shape = SubResource("RectangleShape2D_3bqsq")

[node name="EnemyWeapon" parent="." instance=ExtResource("4_dbwkh")]
WeaponData = ExtResource("5_3jfx2")

[connection signal="area_entered" from="PlayerDetection" to="PlayerDetection" method="_on_area_entered"]
[connection signal="area_exited" from="PlayerDetection" to="PlayerDetection" method="_on_area_exited"]
[connection signal="area_entered" from="DamageHitbox" to="." method="_on_damage_hitbox_area_entered"]
