Refactor projectiles

This commit is contained in:
2023-09-06 15:20:34 -07:00
parent d536aa2014
commit d7dd58b5df
11 changed files with 138 additions and 181 deletions

View File

@@ -2,24 +2,9 @@ using Godot;
public partial class CutterShot : Projectile
{
[Export]
private PathFollow3D _pathFollow;
[Export]
private Sprite3D _sprite;
public override void _Ready()
{
base._Ready();
_pathFollow = GetNode<PathFollow3D>("Path3D/PathFollow3D");
}
public override void _PhysicsProcess(double delta)
{
_pathFollow.Progress += 10f * (float)delta;
if (Mathf.IsEqualApprox(_pathFollow.ProgressRatio, 1.0f))
QueueFree();
}
public override void _Process(double delta)
{
_sprite.RotateY(25);

View File

@@ -14,13 +14,12 @@ point_count = 4
[sub_resource type="CylinderShape3D" id="CylinderShape3D_mgm2i"]
height = 8.481
[node name="CutterShot" type="Node3D" node_paths=PackedStringArray("_pathFollow", "_sprite")]
[node name="CutterShot" type="Node3D" node_paths=PackedStringArray("_sprite")]
script = ExtResource("1_inha4")
_pathFollow = NodePath("Path3D/PathFollow3D")
_sprite = NodePath("Path3D/PathFollow3D/RigidBody3D/Sprite3D")
_sprite = NodePath("Path3D/PathFollow3D/RigidBody3D/CollisionShape3D/Sprite3D")
Cooldown = 0.3
_projectileSpeed = 3.0
_soundEffect = ExtResource("2_u4aoe")
_projectileSpeed = 0.1
[node name="Path3D" type="Path3D" parent="."]
top_level = true
@@ -44,16 +43,9 @@ can_sleep = false
transform = Transform3D(0.999999, 0, 1.19209e-07, 0, 1, 0, -1.19209e-07, 0, 0.999999, 0, 0, 0)
shape = SubResource("CylinderShape3D_mgm2i")
[node name="Sprite3D" type="Sprite3D" parent="Path3D/PathFollow3D/RigidBody3D"]
[node name="Sprite3D" type="Sprite3D" parent="Path3D/PathFollow3D/RigidBody3D/CollisionShape3D"]
transform = Transform3D(0.156513, 0, 0.124514, 0, 0.2, 0, -0.124514, 0, 0.156513, 0, 0, 0)
pixel_size = 0.03
axis = 1
double_sided = false
texture = ExtResource("2_tqxh6")
[node name="TTL" type="Timer" parent="."]
process_callback = 0
wait_time = 0.8
autostart = true
[connection signal="timeout" from="TTL" to="." method="OnTimeToLiveTimeout"]

View File

@@ -14,13 +14,12 @@ point_count = 4
[sub_resource type="CylinderShape3D" id="CylinderShape3D_mgm2i"]
height = 8.481
[node name="CutterShot" type="Node3D" node_paths=PackedStringArray("_pathFollow", "_sprite")]
[node name="CutterShot" type="Node3D" node_paths=PackedStringArray("_sprite")]
script = ExtResource("1_7xtlh")
_pathFollow = NodePath("Path3D/PathFollow3D")
_sprite = NodePath("Path3D/PathFollow3D/RigidBody3D/CollisionShape3D/Sprite3D")
Cooldown = 0.3
_soundEffect = ExtResource("2_qmvk7")
_projectileSpeed = 3.0
_soundEffect = ExtResource("2_qmvk7")
[node name="Path3D" type="Path3D" parent="."]
top_level = true
@@ -50,10 +49,3 @@ pixel_size = 0.03
axis = 1
double_sided = false
texture = ExtResource("2_6mabu")
[node name="TTL" type="Timer" parent="."]
process_callback = 0
wait_time = 0.8
autostart = true
[connection signal="timeout" from="TTL" to="." method="OnTimeToLiveTimeout"]