Update stuff
This commit is contained in:
+18
-26
@@ -1,31 +1,25 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Projectile : Node3D
|
||||
{
|
||||
[Export]
|
||||
public double Cooldown { get; protected set; }
|
||||
|
||||
[Export]
|
||||
private AudioStream _soundEffect;
|
||||
|
||||
[Export]
|
||||
protected float _projectileSpeed = 1f;
|
||||
|
||||
[Export]
|
||||
public AudioStream _soundEffect;
|
||||
|
||||
[Export]
|
||||
public AudioStream _onHitSfx;
|
||||
|
||||
[Export]
|
||||
public RigidBody3D _hitBox;
|
||||
|
||||
[Export]
|
||||
public bool HasRotation = false;
|
||||
|
||||
public override void _Ready()
|
||||
private bool isDeleted = false;
|
||||
|
||||
public override void _EnterTree()
|
||||
{
|
||||
Speed = _projectileSpeed;
|
||||
var sfxPlayer = GetTree().Root.GetNode<AudioStreamPlayer>("Main/SFXPlayer");
|
||||
sfxPlayer.Stream = _soundEffect;
|
||||
sfxPlayer.Play();
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
@@ -33,25 +27,23 @@ public partial class Projectile : Node3D
|
||||
var pathFollow = GetNode<PathFollow3D>("PathFollow3D");
|
||||
pathFollow.Progress += Speed * (float)delta;
|
||||
if (pathFollow.ProgressRatio > 0.98f)
|
||||
QueueFree();
|
||||
Delete();
|
||||
}
|
||||
|
||||
public void OnProjectileHit(Node node)
|
||||
{
|
||||
SetProcess(false);
|
||||
if (node is BasicEnemy basicEnemy && basicEnemy.HasMethod(BasicEnemy.MethodName.OnEnemyHit))
|
||||
{
|
||||
if (node is BasicEnemy basicEnemy)
|
||||
basicEnemy.Call(BasicEnemy.MethodName.OnEnemyHit, node);
|
||||
GD.Print("Hit enemy at " + basicEnemy.Position);
|
||||
Delete();
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
if (!isDeleted)
|
||||
{
|
||||
isDeleted = true;
|
||||
QueueFree();
|
||||
}
|
||||
else
|
||||
GD.Print("Hit something other than enemy: " + node.Name);
|
||||
|
||||
_hitBox.QueueFree();
|
||||
|
||||
var sfxPlayer = GetTree().Root.GetNode<AudioStreamPlayer>("Main/SFXPlayer");
|
||||
if (!sfxPlayer.Playing)
|
||||
sfxPlayer.Play();
|
||||
}
|
||||
|
||||
public float Speed { get; private set; }
|
||||
|
||||
@@ -27,7 +27,7 @@ point_count = 2
|
||||
height = 44.0
|
||||
radius = 0.3
|
||||
|
||||
[node name="Capricorn Laser" type="Node3D"]
|
||||
[node name="Capricorn Laser" type="Node3D" groups=["Projectile"]]
|
||||
|
||||
[node name="Forward Shot" type="Path3D" parent="." node_paths=PackedStringArray("_hitBox")]
|
||||
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 0.105376, 0.772365, 1.51984)
|
||||
|
||||
@@ -27,7 +27,7 @@ point_count = 2
|
||||
height = 44.0
|
||||
radius = 0.3
|
||||
|
||||
[node name="Capricorn Laser Alt" type="Node3D"]
|
||||
[node name="Capricorn Laser Alt" type="Node3D" groups=["Projectile"]]
|
||||
|
||||
[node name="Forward Shot" type="Path3D" parent="." node_paths=PackedStringArray("_hitBox")]
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -1.5, 1, 0)
|
||||
|
||||
@@ -1,37 +1,87 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bq40xbqibrk1y"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://bq40xbqibrk1y"]
|
||||
|
||||
[ext_resource type="Script" path="res://Player/Base/Projectile.cs" id="1_ivbjp"]
|
||||
[ext_resource type="Texture2D" uid="uid://crlvrwo2l11ja" path="res://Textures/Projectiles/Projectile_Pisces_MultiAttack.png" id="2_a612r"]
|
||||
[ext_resource type="AudioStream" uid="uid://cw1jlubd7wmw6" path="res://Audio/SFX/blue laser.wav" id="2_oxtlx"]
|
||||
[ext_resource type="AudioStream" uid="uid://cat08h84wm5gm" path="res://Audio/SFX/ominous.wav" id="4_2g102"]
|
||||
[ext_resource type="AudioStream" uid="uid://cgun34h06gvpv" path="res://Audio/SFX/misc1.wav" id="4_2jy1s"]
|
||||
|
||||
[sub_resource type="Curve3D" id="Curve3D_h8ghr"]
|
||||
_data = {
|
||||
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.008, 0, -5),
|
||||
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.008, 0, -1.5),
|
||||
"tilts": PackedFloat32Array(0, 0)
|
||||
}
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_ebbqv"]
|
||||
height = 13.6565
|
||||
height = 8.0
|
||||
radius = 0.3
|
||||
|
||||
[node name="ShotgunBullet" type="Node3D"]
|
||||
[sub_resource type="Animation" id="Animation_88db4"]
|
||||
length = 0.001
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3fawr"]
|
||||
resource_name = "ShotDissolve"
|
||||
length = 0.25
|
||||
tracks/0/type = "method"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.25),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"Delete"
|
||||
}]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("AudioStreamPlayer:stream")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("4_2jy1s")]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("AudioStreamPlayer:playing")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_tv0mi"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_88db4"),
|
||||
"ShotDissolve": SubResource("Animation_3fawr")
|
||||
}
|
||||
|
||||
[node name="ShotgunBullet" type="Node3D" groups=["Projectile"]]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.73894, 0)
|
||||
|
||||
[node name="Center Shot" type="Path3D" parent="." node_paths=PackedStringArray("_hitBox")]
|
||||
[node name="Center Shot" type="Path3D" parent="."]
|
||||
transform = Transform3D(0.999968, 0, -0.00802843, 0, 1, 0, 0.00802843, 0, 0.999968, -0.0325268, 0.758171, -0.821681)
|
||||
top_level = true
|
||||
curve = SubResource("Curve3D_h8ghr")
|
||||
script = ExtResource("1_ivbjp")
|
||||
Cooldown = 0.5
|
||||
_projectileSpeed = 3.0
|
||||
_soundEffect = ExtResource("2_oxtlx")
|
||||
_onHitSfx = ExtResource("4_2g102")
|
||||
_hitBox = NodePath("PathFollow3D/Hitbox")
|
||||
_projectileSpeed = 2.0
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" parent="Center Shot"]
|
||||
transform = Transform3D(0.999998, 0, -0.0016, 0, 1, 0, 0.0016, 0, 0.999998, 0, 0, 0)
|
||||
transform = Transform3D(0.999985, 0, -0.00533325, 0, 1, 0, 0.00533325, 0, 0.999985, 0, 0, 0)
|
||||
loop = false
|
||||
tilt_enabled = false
|
||||
|
||||
@@ -40,7 +90,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00512208, 0, 0.096)
|
||||
collision_layer = 44
|
||||
gravity_scale = 0.0
|
||||
continuous_cd = true
|
||||
max_contacts_reported = 1000
|
||||
max_contacts_reported = 1
|
||||
contact_monitor = true
|
||||
can_sleep = false
|
||||
|
||||
@@ -52,19 +102,26 @@ shape = SubResource("CylinderShape3D_ebbqv")
|
||||
axis = 1
|
||||
texture = ExtResource("2_a612r")
|
||||
|
||||
[node name="Left Shot" type="Path3D" parent="." node_paths=PackedStringArray("_hitBox")]
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Center Shot"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_tv0mi")
|
||||
}
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Center Shot"]
|
||||
stream = ExtResource("4_2g102")
|
||||
autoplay = true
|
||||
|
||||
[node name="Left Shot" type="Path3D" parent="."]
|
||||
transform = Transform3D(0.970524, 0, 0.241007, 0, 1, 0, -0.241007, 0, 0.970524, -0.444877, 0.758171, -0.564578)
|
||||
top_level = true
|
||||
curve = SubResource("Curve3D_h8ghr")
|
||||
script = ExtResource("1_ivbjp")
|
||||
Cooldown = 0.5
|
||||
_projectileSpeed = 3.0
|
||||
_soundEffect = ExtResource("2_oxtlx")
|
||||
_onHitSfx = ExtResource("4_2g102")
|
||||
_hitBox = NodePath("PathFollow3D/Hitbox")
|
||||
_projectileSpeed = 2.0
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" parent="Left Shot"]
|
||||
transform = Transform3D(0.999998, 0, -0.0016, 0, 1, 0, 0.0016, 0, 0.999998, 0, 0, 0)
|
||||
transform = Transform3D(0.999985, 0, -0.00533325, 0, 1, 0, 0.00533325, 0, 0.999985, 0, 0, 0)
|
||||
loop = false
|
||||
tilt_enabled = false
|
||||
|
||||
@@ -73,8 +130,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03827, 0, 0.0309103)
|
||||
collision_layer = 44
|
||||
gravity_scale = 0.0
|
||||
continuous_cd = true
|
||||
max_contacts_reported = 1000
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 1
|
||||
can_sleep = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Left Shot/PathFollow3D/Hitbox"]
|
||||
@@ -85,19 +141,26 @@ shape = SubResource("CylinderShape3D_ebbqv")
|
||||
axis = 1
|
||||
texture = ExtResource("2_a612r")
|
||||
|
||||
[node name="Right Shot" type="Path3D" parent="." node_paths=PackedStringArray("_hitBox")]
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Left Shot"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_tv0mi")
|
||||
}
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Left Shot"]
|
||||
stream = ExtResource("4_2jy1s")
|
||||
autoplay = true
|
||||
|
||||
[node name="Right Shot" type="Path3D" parent="."]
|
||||
transform = Transform3D(0.95246, 0, -0.304665, 0, 1, 0, 0.304665, 0, 0.95246, 0.441688, 0.758171, -0.681987)
|
||||
top_level = true
|
||||
curve = SubResource("Curve3D_h8ghr")
|
||||
script = ExtResource("1_ivbjp")
|
||||
Cooldown = 0.5
|
||||
_projectileSpeed = 3.0
|
||||
_soundEffect = ExtResource("2_oxtlx")
|
||||
_onHitSfx = ExtResource("4_2g102")
|
||||
_hitBox = NodePath("PathFollow3D/Hitbox")
|
||||
_projectileSpeed = 2.0
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" parent="Right Shot"]
|
||||
transform = Transform3D(0.999998, 0, -0.0016, 0, 1, 0, 0.0016, 0, 0.999998, 0, 0, 0)
|
||||
transform = Transform3D(0.999985, 0, -0.00533326, 0, 1, 0, 0.00533326, 0, 0.999985, 0, 0, 0)
|
||||
loop = false
|
||||
tilt_enabled = false
|
||||
|
||||
@@ -106,8 +169,7 @@ transform = Transform3D(-1, 0, -0.00159994, 0, 1, 0, 0.00159994, 0, -1, -0.06, 0
|
||||
collision_layer = 44
|
||||
gravity_scale = 0.0
|
||||
continuous_cd = true
|
||||
max_contacts_reported = 1000
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 1
|
||||
can_sleep = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Right Shot/PathFollow3D/Hitbox"]
|
||||
@@ -118,6 +180,15 @@ shape = SubResource("CylinderShape3D_ebbqv")
|
||||
axis = 1
|
||||
texture = ExtResource("2_a612r")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Right Shot"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_tv0mi")
|
||||
}
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Right Shot"]
|
||||
stream = ExtResource("2_oxtlx")
|
||||
autoplay = true
|
||||
|
||||
[connection signal="body_entered" from="Center Shot/PathFollow3D/Hitbox" to="Center Shot" method="OnProjectileHit"]
|
||||
[connection signal="body_entered" from="Left Shot/PathFollow3D/Hitbox" to="Left Shot" method="OnProjectileHit"]
|
||||
[connection signal="body_entered" from="Right Shot/PathFollow3D/Hitbox" to="Right Shot" method="OnProjectileHit"]
|
||||
|
||||
@@ -16,7 +16,7 @@ point_count = 3
|
||||
height = 3.3177
|
||||
radius = 0.57027
|
||||
|
||||
[node name="MegamiBeam" type="Node3D"]
|
||||
[node name="MegamiBeam" type="Node3D" groups=["Projectile"]]
|
||||
|
||||
[node name="Path3D" type="Path3D" parent="." node_paths=PackedStringArray("_hitBox")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0430247, 0.484383)
|
||||
|
||||
@@ -16,7 +16,7 @@ point_count = 4
|
||||
height = 8.481
|
||||
radius = 0.304769
|
||||
|
||||
[node name="CutterShot" type="Node3D"]
|
||||
[node name="CutterShot" type="Node3D" groups=["Projectile"]]
|
||||
|
||||
[node name="Path3D" type="Path3D" parent="." node_paths=PackedStringArray("_sprite", "_hitBox")]
|
||||
top_level = true
|
||||
|
||||
@@ -16,7 +16,7 @@ point_count = 4
|
||||
height = 8.481
|
||||
radius = 0.272422
|
||||
|
||||
[node name="CutterAlt" type="Node3D"]
|
||||
[node name="CutterAlt" type="Node3D" groups=["Projectile"]]
|
||||
|
||||
[node name="CutterShot" type="Path3D" parent="." node_paths=PackedStringArray("_sprite", "_hitBox")]
|
||||
top_level = true
|
||||
|
||||
Reference in New Issue
Block a user