Remove detection spheres

This commit is contained in:
2024-09-01 15:30:29 -07:00
parent b0e8ab124a
commit 4c44486fd4
3 changed files with 2 additions and 66 deletions

View File

@@ -31,10 +31,6 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
[Export] [Export]
public Resource EnemyStats { get; set; } = new(); public Resource EnemyStats { get; set; } = new();
[Node] public Area3D DetectionSphere { get; set; } = default!;
[Node] public Area3D AlertedSphere { get; set; } = default!;
public static PackedScene CollisionDetectorScene => GD.Load<PackedScene>("res://src/enemy/CollisionDetector.tscn"); public static PackedScene CollisionDetectorScene => GD.Load<PackedScene>("res://src/enemy/CollisionDetector.tscn");
public static Area3D CollisionDetector { get; set; } = default!; public static Area3D CollisionDetector { get; set; } = default!;
@@ -53,8 +49,6 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
{ {
var enemyResource = EnemyStats as EnemyStats; var enemyResource = EnemyStats as EnemyStats;
CurrentHP = enemyResource.MaximumHP; CurrentHP = enemyResource.MaximumHP;
DetectionSphere.BodyEntered += OnDetectionSphereEntered;
AlertedSphere.BodyExited += OnAlertedSphereExited;
} }
public void OnResolved() public void OnResolved()
@@ -122,18 +116,6 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
} }
} }
public void OnDetectionSphereEntered(Node3D body)
{
GD.Print($"Detected {body.Name}...");
EnemyLogic.Input(new EnemyLogic.Input.Alerted());
}
public void OnAlertedSphereExited(Node3D body)
{
GD.Print($"Lost track of {body.Name}...");
EnemyLogic.Input(new EnemyLogic.Input.LostPlayer());
}
public void OnReady() public void OnReady()
{ {
SetPhysicsProcess(true); SetPhysicsProcess(true);

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=26 format=3 uid="uid://u1vmmakcoplh"] [gd_scene load_steps=24 format=3 uid="uid://u1vmmakcoplh"]
[ext_resource type="Script" path="res://src/enemy/Enemy.cs" id="1_yhru4"] [ext_resource type="Script" path="res://src/enemy/Enemy.cs" id="1_yhru4"]
[ext_resource type="Texture2D" uid="uid://eqmjpiaec28" path="res://src/enemy/enemy_types/Capricorn/sprites/GameJam_DevilCapricorn_WalkForward.png" id="2_3b07r"] [ext_resource type="Texture2D" uid="uid://eqmjpiaec28" path="res://src/enemy/enemy_types/Capricorn/sprites/GameJam_DevilCapricorn_WalkForward.png" id="2_3b07r"]
@@ -9,12 +9,6 @@
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_p0yqe"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_p0yqe"]
radius = 1.0 radius = 1.0
[sub_resource type="SphereShape3D" id="SphereShape3D_3pxe5"]
radius = 5.0
[sub_resource type="SphereShape3D" id="SphereShape3D_fva4b"]
radius = 7.0
[sub_resource type="AtlasTexture" id="AtlasTexture_blequ"] [sub_resource type="AtlasTexture" id="AtlasTexture_blequ"]
atlas = ExtResource("3_jdsw3") atlas = ExtResource("3_jdsw3")
region = Rect2(0, 0, 120, 132) region = Rect2(0, 0, 120, 132)
@@ -167,24 +161,6 @@ debug_path_custom_color = Color(1, 0, 0, 1)
transform = Transform3D(1, 0, 1.06581e-14, 0, 1, 0, -1.06581e-14, 0, 1, 0, 0, 0) transform = Transform3D(1, 0, 1.06581e-14, 0, 1, 0, -1.06581e-14, 0, 1, 0, 0, 0)
shape = SubResource("CapsuleShape3D_p0yqe") shape = SubResource("CapsuleShape3D_p0yqe")
[node name="DetectionSphere" type="Area3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(0.707107, 0, -0.707107, 0, 1, 0, 0.707107, 0, 0.707107, 0.689022, 0, -2.13941)
collision_layer = 0
collision_mask = 32
[node name="CollisionShape3D" type="CollisionShape3D" parent="DetectionSphere"]
shape = SubResource("SphereShape3D_3pxe5")
[node name="AlertedSphere" type="Area3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(0.707107, 0, -0.707107, 0, 1, 0, 0.707107, 0, 0.707107, 0.689022, 0, -2.13941)
collision_layer = 0
collision_mask = 32
[node name="CollisionShape3D" type="CollisionShape3D" parent="AlertedSphere"]
shape = SubResource("SphereShape3D_fva4b")
[node name="Sprite" type="AnimatedSprite3D" parent="."] [node name="Sprite" type="AnimatedSprite3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=4 uid="uid://dcgj5i52i76gj"] [gd_scene load_steps=9 format=4 uid="uid://dcgj5i52i76gj"]
[ext_resource type="Script" path="res://src/enemy/Enemy.cs" id="1_4d86o"] [ext_resource type="Script" path="res://src/enemy/Enemy.cs" id="1_4d86o"]
[ext_resource type="Resource" uid="uid://bcsyqy7rmbpbl" path="res://src/enemy/enemy_types/FloatingEnemy.tres" id="2_q8v6p"] [ext_resource type="Resource" uid="uid://bcsyqy7rmbpbl" path="res://src/enemy/enemy_types/FloatingEnemy.tres" id="2_q8v6p"]
@@ -104,12 +104,6 @@ _surfaces = [{
blend_shape_mode = 0 blend_shape_mode = 0
shadow_mesh = SubResource("ArrayMesh_2wch8") shadow_mesh = SubResource("ArrayMesh_2wch8")
[sub_resource type="SphereShape3D" id="SphereShape3D_wi5jl"]
radius = 11.037
[sub_resource type="SphereShape3D" id="SphereShape3D_ijaea"]
radius = 48.442
[node name="EnemyGuy" type="CharacterBody3D"] [node name="EnemyGuy" type="CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
collision_layer = 10 collision_layer = 10
@@ -128,22 +122,6 @@ transform = Transform3D(-7.57406e-09, -0.203117, 0, 0.173274, -8.87853e-09, 0, 0
mesh = SubResource("ArrayMesh_w2sup") mesh = SubResource("ArrayMesh_w2sup")
skeleton = NodePath("") skeleton = NodePath("")
[node name="DetectionSphere" type="Area3D" parent="."]
unique_name_in_owner = true
collision_layer = 0
collision_mask = 32
[node name="CollisionShape3D" type="CollisionShape3D" parent="DetectionSphere"]
shape = SubResource("SphereShape3D_wi5jl")
[node name="AlertedSphere" type="Area3D" parent="."]
unique_name_in_owner = true
collision_layer = 0
collision_mask = 32
[node name="CollisionShape3D" type="CollisionShape3D" parent="AlertedSphere"]
shape = SubResource("SphereShape3D_ijaea")
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="."] [node name="NavigationAgent3D" type="NavigationAgent3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
simplify_path = true simplify_path = true