using Godot; using Godot.Collections; using System.Linq; public partial class Projectile : Node3D { [Export] public double Cooldown { get; protected set; } [Export] protected float _projectileSpeed = 1f; [Export] public AudioStream _soundEffect; public Character ParentCharacter; private Array _paths; public override void _Ready() { Speed = _projectileSpeed; var sfxPlayer = GetTree().Root.GetNode("Main/SFXPlayer"); sfxPlayer.Stream = _soundEffect; sfxPlayer.Play(); _paths = new Array(GetChildren().OfType()); } public override void _PhysicsProcess(double delta) { foreach (var paths in _paths) { var pathFollow = paths.GetChildren().OfType().Single(); pathFollow.Progress += Speed * (float)delta; if (pathFollow.ProgressRatio > 0.9f) QueueFree(); } } public float Speed { get; private set; } }