This commit is contained in:
2023-09-11 17:42:11 -07:00
parent ba9c1e320e
commit 4d8fbda71b
21 changed files with 123 additions and 67 deletions

View File

@@ -2,12 +2,6 @@ using Godot;
public partial class EnemyBullet : Projectile
{
public override void _PhysicsProcess(double delta)
{
TranslateObjectLocal(new Vector3(0, 0, -Speed * (float)delta));
}
public new void OnProjectileHit(Node node)
{
SetPhysicsProcess(false);
@@ -15,7 +9,7 @@ public partial class EnemyBullet : Projectile
if (node is Character character && character.HasMethod(Character.MethodName.OnHit))
{
GD.Print("Player hit: " + character.Name);
character.Call(Character.MethodName.OnHit, node);
character.Call(Character.MethodName.OnHit, this);
}
QueueFree();

View File

@@ -2,22 +2,32 @@
[ext_resource type="Script" path="res://Enemies/Attacks/EnemyBullet.cs" id="1_rv13r"]
[ext_resource type="Texture2D" uid="uid://dd71tdgrgic46" path="res://Textures/Projectiles/LB ORB.png" id="2_6l2aj"]
[ext_resource type="AudioStream" uid="uid://cfj82os5p8i4p" path="res://Audio/SFX/shooting.wav" id="2_q6wdf"]
[sub_resource type="Curve3D" id="Curve3D_eve6n"]
_data = {
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -3),
"tilts": PackedFloat32Array(0, 0)
}
point_count = 2
[sub_resource type="CylinderShape3D" id="CylinderShape3D_e4v7f"]
height = 2.31583
height = 15.359
radius = 0.154574
[node name="TestBullet" type="Node3D"]
[node name="EnemyBullet" type="Path3D"]
curve = SubResource("Curve3D_eve6n")
script = ExtResource("1_rv13r")
Cooldown = 3.0
_soundEffect = ExtResource("2_q6wdf")
[node name="RigidBody3D" type="RigidBody3D" parent="."]
[node name="PathFollow3D" type="PathFollow3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
loop = false
tilt_enabled = false
[node name="RigidBody3D" type="RigidBody3D" parent="PathFollow3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
collision_layer = 0
collision_mask = 3
gravity_scale = 0.0
custom_integrator = true
continuous_cd = true
max_contacts_reported = 10
contact_monitor = true
@@ -26,19 +36,19 @@ lock_rotation = true
freeze = true
freeze_mode = 1
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="PathFollow3D/RigidBody3D"]
transform = Transform3D(0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0.0111055, 1.02602, 0)
shape = SubResource("CylinderShape3D_e4v7f")
[node name="Sprite3D" type="Sprite3D" parent="RigidBody3D/CollisionShape3D"]
[node name="Sprite3D" type="Sprite3D" parent="PathFollow3D/RigidBody3D/CollisionShape3D"]
transform = Transform3D(0.08, 0, 0, 0, 0.08, 0, 0, 0, 0.08, -0.390424, 0, 0.436329)
centered = false
axis = 1
texture = ExtResource("2_6l2aj")
[node name="TTL" type="Timer" parent="."]
[node name="TTL" type="Timer" parent="PathFollow3D"]
process_callback = 0
wait_time = 0.8
autostart = true
[connection signal="body_entered" from="RigidBody3D" to="." method="OnProjectileHit"]
[connection signal="body_entered" from="PathFollow3D/RigidBody3D" to="." method="OnProjectileHit"]