Re-enable collisions

This commit is contained in:
Steven Long
2023-09-07 23:28:00 -07:00
parent 8e363587b9
commit 5362240120
9 changed files with 36 additions and 78 deletions

View File

@@ -7,4 +7,21 @@ public partial class EnemyBullet : Projectile
{
TranslateObjectLocal(new Vector3(0, 0, -Speed * (float)delta));
}
public new void OnProjectileHit(Node node)
{
SetPhysicsProcess(false);
_hitBox.QueueFree();
if (node is Character character && character.HasMethod(Character.MethodName.OnHit))
{
GD.Print("Player hit: " + character.Name);
character.Call(Character.MethodName.OnHit, node);
}
var sfxPlayer = GetTree().Root.GetNode<AudioStreamPlayer>("Main/SFXPlayer");
if (!sfxPlayer.Playing)
sfxPlayer.Play();
}
}

View File

@@ -18,7 +18,7 @@ _hitBox = NodePath("RigidBody3D")
[node name="RigidBody3D" type="RigidBody3D" parent="."]
collision_layer = 0
collision_mask = 0
collision_mask = 2
gravity_scale = 0.0
custom_integrator = true
continuous_cd = true

View File

@@ -1,5 +1,5 @@
using Godot;
using System.Linq;
using Godot;
public partial class FireAtPlayer : Timer
{
@@ -21,9 +21,4 @@ public partial class FireAtPlayer : Timer
GetParent().AddChild(projectile);
}
}
private void OnDied()
{
Stop();
}
}