Fix enemy attacks
This commit is contained in:
@@ -139,7 +139,7 @@ namespace GameJamDungeon
|
||||
GlobalPosition = GameRepo.PlayerGlobalPosition.Value;
|
||||
GameRepo.PlayerGlobalPosition.Sync += PlayerGlobalPosition_Sync;
|
||||
HealthTimer.Timeout += OnHealthTimerTimeout;
|
||||
CollisionDetector.AreaEntered += OnEnemyHitBoxEntered;
|
||||
CollisionDetector.BodyEntered += CollisionDetector_BodyEntered;
|
||||
PlayerData.Inventory.AccessoryUnequipped += Inventory_AccessoryUnequipped;
|
||||
}
|
||||
|
||||
@@ -267,9 +267,9 @@ namespace GameJamDungeon
|
||||
HealthTimer.WaitTime = _healthTimerWaitTime;
|
||||
}
|
||||
|
||||
private void OnEnemyHitBoxEntered(Area3D area)
|
||||
private void CollisionDetector_BodyEntered(Node3D body)
|
||||
{
|
||||
if (area is IHitbox hitBox)
|
||||
if (body is IHitbox hitBox)
|
||||
{
|
||||
var enemy = hitBox.GetParent<IEnemy>();
|
||||
var isCriticalHit = false;
|
||||
@@ -284,6 +284,7 @@ namespace GameJamDungeon
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void CurrentHP_Sync(int newHealth)
|
||||
{
|
||||
if (newHealth <= 0)
|
||||
|
||||
@@ -33,7 +33,7 @@ Luck = 0.05
|
||||
radius = 1.0
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_hs4wf"]
|
||||
size = Vector3(1.94531, 2.43945, 1.08447)
|
||||
size = Vector3(1.94531, 2.43945, 2.35425)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_hcjph"]
|
||||
length = 0.001
|
||||
@@ -366,10 +366,10 @@ shape = SubResource("CapsuleShape3D_dw45s")
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.937567, 0)
|
||||
collision_layer = 196
|
||||
collision_mask = 132
|
||||
collision_mask = 196
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="CollisionShape3D/CollisionDetector"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0479561, 0.982638, -0.04021)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0479561, 0.982638, -0.675098)
|
||||
shape = SubResource("BoxShape3D_hs4wf")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
|
||||
Reference in New Issue
Block a user