Refactor
This commit is contained in:
@@ -1,20 +1,37 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://5ce7ky4o0q2e"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://5ce7ky4o0q2e"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dha44dnvwhajo" path="res://Textures/Projectiles/Projectile_Capricorn.png" id="1_bvyt4"]
|
||||
[ext_resource type="Script" path="res://Player/Capricorn/Attacks/CapricornLaserShot.cs" id="1_nkyy8"]
|
||||
[ext_resource type="AudioStream" uid="uid://bykwwct1not4e" path="res://Audio/SFX/capricorn laeser.wav" id="2_lofnw"]
|
||||
|
||||
[sub_resource type="Curve3D" id="Curve3D_bnc6v"]
|
||||
_data = {
|
||||
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0.008, 1, -5),
|
||||
"tilts": PackedFloat32Array(0, 0)
|
||||
}
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_bnunv"]
|
||||
height = 7.40727
|
||||
radius = 0.419241
|
||||
|
||||
[node name="CapricornLaser" type="Node3D"]
|
||||
script = ExtResource("1_nkyy8")
|
||||
Cooldown = 1.0
|
||||
_soundEffect = ExtResource("2_lofnw")
|
||||
_projectileSpeed = 3.0
|
||||
|
||||
[node name="Forward Shot" type="RigidBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
|
||||
[node name="Forward Shot" type="Path3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.25)
|
||||
top_level = true
|
||||
curve = SubResource("Curve3D_bnc6v")
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" parent="Forward Shot"]
|
||||
transform = Transform3D(-0.999998, 0, 0.00159994, 0, 1, 0, -0.00159994, 0, -0.999998, 0, 1, 0)
|
||||
loop = false
|
||||
tilt_enabled = false
|
||||
|
||||
[node name="Hitbox" type="RigidBody3D" parent="Forward Shot/PathFollow3D"]
|
||||
transform = Transform3D(-1, 0, -0.000800046, 0, 1, 0, 0.000800046, 0, -1, 0.000400023, -1, 0.5)
|
||||
collision_layer = 0
|
||||
collision_mask = 34
|
||||
gravity_scale = 0.0
|
||||
@@ -23,18 +40,28 @@ max_contacts_reported = 1
|
||||
contact_monitor = true
|
||||
can_sleep = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Forward Shot"]
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Forward Shot/PathFollow3D/Hitbox"]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
|
||||
shape = SubResource("CylinderShape3D_bnunv")
|
||||
|
||||
[node name="Sprite3D2" type="Sprite3D" parent="Forward Shot"]
|
||||
[node name="Sprite3D2" type="Sprite3D" parent="Forward Shot/PathFollow3D/Hitbox"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.33, 0, 0.5)
|
||||
centered = false
|
||||
axis = 1
|
||||
texture = ExtResource("1_bvyt4")
|
||||
|
||||
[node name="BackwardShot" type="RigidBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0.5)
|
||||
[node name="Backward Shot" type="Path3D" parent="."]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0.25)
|
||||
top_level = true
|
||||
curve = SubResource("Curve3D_bnc6v")
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" parent="Backward Shot"]
|
||||
transform = Transform3D(-0.999998, 0, 0.00159994, 0, 1, 0, -0.00159994, 0, -0.999998, 0, 1, 0)
|
||||
loop = false
|
||||
tilt_enabled = false
|
||||
|
||||
[node name="Hitbox" type="RigidBody3D" parent="Backward Shot/PathFollow3D"]
|
||||
transform = Transform3D(-1, 0, -0.000800046, 0, 1, 0, 0.000800046, 0, -1, 0.000400023, -1, 0.5)
|
||||
collision_layer = 0
|
||||
collision_mask = 34
|
||||
gravity_scale = 0.0
|
||||
@@ -43,12 +70,12 @@ max_contacts_reported = 1
|
||||
contact_monitor = true
|
||||
can_sleep = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="BackwardShot"]
|
||||
transform = Transform3D(-0.5, 0, -4.37114e-08, 0, 0.5, 0, 4.37114e-08, 0, -0.5, 0, -0.5, 0.5)
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Backward Shot/PathFollow3D/Hitbox"]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
|
||||
shape = SubResource("CylinderShape3D_bnunv")
|
||||
|
||||
[node name="Sprite3D2" type="Sprite3D" parent="BackwardShot/CollisionShape3D"]
|
||||
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -0.66, 0, 0.965768)
|
||||
[node name="Sprite3D2" type="Sprite3D" parent="Backward Shot/PathFollow3D/Hitbox"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.33, 0, 0.5)
|
||||
centered = false
|
||||
axis = 1
|
||||
texture = ExtResource("1_bvyt4")
|
||||
|
||||
@@ -1,21 +1,39 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cdsc35cj566q1"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cdsc35cj566q1"]
|
||||
|
||||
[ext_resource type="Script" path="res://Player/Capricorn/Attacks/CapricornLaserShot.cs" id="1_8lywi"]
|
||||
[ext_resource type="Texture2D" uid="uid://dha44dnvwhajo" path="res://Textures/Projectiles/Projectile_Capricorn.png" id="2_8osg4"]
|
||||
[ext_resource type="AudioStream" uid="uid://bykwwct1not4e" path="res://Audio/SFX/capricorn laeser.wav" id="2_jeoco"]
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_bnunv"]
|
||||
height = 8.32444
|
||||
[sub_resource type="Curve3D" id="Curve3D_goxuk"]
|
||||
_data = {
|
||||
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0.008, 1, -5),
|
||||
"tilts": PackedFloat32Array(0, 0)
|
||||
}
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_hebl4"]
|
||||
height = 7.40727
|
||||
radius = 0.419241
|
||||
|
||||
[node name="CapricornLaser" type="Node3D"]
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -0.242816, 0, 0)
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0)
|
||||
script = ExtResource("1_8lywi")
|
||||
Cooldown = 1.0
|
||||
_soundEffect = ExtResource("2_jeoco")
|
||||
_projectileSpeed = 3.0
|
||||
|
||||
[node name="Forward Shot" type="RigidBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
|
||||
[node name="Forward Shot" type="Path3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.25)
|
||||
top_level = true
|
||||
curve = SubResource("Curve3D_goxuk")
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" parent="Forward Shot"]
|
||||
transform = Transform3D(-0.999998, 0, 0.00159994, 0, 1, 0, -0.00159994, 0, -0.999998, 0, 1, 0)
|
||||
loop = false
|
||||
tilt_enabled = false
|
||||
|
||||
[node name="Hitbox" type="RigidBody3D" parent="Forward Shot/PathFollow3D"]
|
||||
transform = Transform3D(-1, 0, -0.000800046, 0, 1, 0, 0.000800046, 0, -1, 0.000400023, -1, 0.5)
|
||||
collision_layer = 34
|
||||
collision_mask = 34
|
||||
gravity_scale = 0.0
|
||||
@@ -24,18 +42,28 @@ max_contacts_reported = 1
|
||||
contact_monitor = true
|
||||
can_sleep = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Forward Shot"]
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Forward Shot/PathFollow3D/Hitbox"]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
|
||||
shape = SubResource("CylinderShape3D_bnunv")
|
||||
shape = SubResource("CylinderShape3D_hebl4")
|
||||
|
||||
[node name="Sprite3D2" type="Sprite3D" parent="Forward Shot"]
|
||||
[node name="Sprite3D2" type="Sprite3D" parent="Forward Shot/PathFollow3D/Hitbox"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.33, 0, 0.5)
|
||||
centered = false
|
||||
axis = 1
|
||||
texture = ExtResource("2_8osg4")
|
||||
|
||||
[node name="BackwardShot" type="RigidBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0.5)
|
||||
[node name="Backward Shot" type="Path3D" parent="."]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0.25)
|
||||
top_level = true
|
||||
curve = SubResource("Curve3D_goxuk")
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" parent="Backward Shot"]
|
||||
transform = Transform3D(-0.999998, 0, 0.00159994, 0, 1, 0, -0.00159994, 0, -0.999998, 0, 1, 0)
|
||||
loop = false
|
||||
tilt_enabled = false
|
||||
|
||||
[node name="Hitbox" type="RigidBody3D" parent="Backward Shot/PathFollow3D"]
|
||||
transform = Transform3D(-1, 0, -0.000800046, 0, 1, 0, 0.000800046, 0, -1, 0.000400023, -1, 0.5)
|
||||
collision_layer = 34
|
||||
collision_mask = 34
|
||||
gravity_scale = 0.0
|
||||
@@ -44,12 +72,12 @@ max_contacts_reported = 1
|
||||
contact_monitor = true
|
||||
can_sleep = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="BackwardShot"]
|
||||
transform = Transform3D(-0.5, 0, -4.37114e-08, 0, 0.5, 0, 4.37114e-08, 0, -0.5, 0, -0.5, 0.5)
|
||||
shape = SubResource("CylinderShape3D_bnunv")
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Backward Shot/PathFollow3D/Hitbox"]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
|
||||
shape = SubResource("CylinderShape3D_hebl4")
|
||||
|
||||
[node name="Sprite3D2" type="Sprite3D" parent="BackwardShot/CollisionShape3D"]
|
||||
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -0.66, 0, 0.965768)
|
||||
[node name="Sprite3D2" type="Sprite3D" parent="Backward Shot/PathFollow3D/Hitbox"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.33, 0, 0.5)
|
||||
centered = false
|
||||
axis = 1
|
||||
texture = ExtResource("2_8osg4")
|
||||
|
||||
@@ -1,12 +1,35 @@
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
using System.Linq;
|
||||
|
||||
public partial class CapricornLaserShot : Projectile
|
||||
{
|
||||
private Array<Path3D> _paths;
|
||||
|
||||
public new float Speed { get; private set; }
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Speed = _projectileSpeed;
|
||||
var sfxPlayer = GetTree().Root.GetNode<AudioStreamPlayer>("Main/SFXPlayer");
|
||||
sfxPlayer.Stream = _soundEffect;
|
||||
sfxPlayer.Play();
|
||||
_paths = new Array<Path3D>(GetChildren().OfType<Path3D>());
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
var shots = GetChildren().OfType<RigidBody3D>();
|
||||
shots.ElementAt(0).Translate(new Vector3(0, 0, Speed * -(float)delta));
|
||||
shots.ElementAt(1).Translate(new Vector3(0, 0, Speed * (float)delta));
|
||||
foreach (var paths in _paths)
|
||||
{
|
||||
var pathFollow = paths.GetChildren().OfType<PathFollow3D>().Single();
|
||||
pathFollow.Progress += Speed * (float)delta;
|
||||
if (Mathf.IsEqualApprox(pathFollow.ProgressRatio, 1.0f))
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBulletHitObject(Node node)
|
||||
{
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user