Files
GameJam2023/Player/Sagittarius/Attacks/MegamiBeamShot.cs
2023-09-06 03:49:16 -07:00

32 lines
817 B
C#

using Godot;
using System.Linq;
public partial class MegamiBeamShot : Projectile
{
[Export]
private PathFollow3D _pathFollow;
[Export]
public new AudioStream _soundEffect;
public override void _Ready()
{
_pathFollow = GetNode<PathFollow3D>("Path3D/PathFollow3D");
_pathFollow.GetParentNode3D().Rotation = ParentCharacter.GetNode<Node3D>("Pivot").Rotation;
var sfxPlayer = GetTree().Root.GetNode<AudioStreamPlayer>("Main/SFXPlayer");
sfxPlayer.Stream = _soundEffect;
sfxPlayer.Play();
}
public override void _PhysicsProcess(double delta)
{
_pathFollow.Progress += 10f * (float)delta;
if (Mathf.IsEqualApprox(_pathFollow.ProgressRatio, 1.0f))
QueueFree();
}
private void OnBulletHitObject(Node node)
{
QueueFree();
}
}