30 lines
649 B
C#
30 lines
649 B
C#
using Godot;
|
|
using System.IO;
|
|
|
|
public partial class Projectile : Node3D
|
|
{
|
|
[Export]
|
|
public double Cooldown { get; protected set; }
|
|
|
|
public Character ParentCharacter;
|
|
|
|
[Export]
|
|
private float _projectileSpeed = 1f;
|
|
|
|
public override void _Ready()
|
|
{
|
|
Speed = _projectileSpeed;
|
|
var sfxPlayer = GetTree().Root.GetNode<AudioStreamPlayer>("Main/SFXPlayer");
|
|
var audioStream = ResourceLoader.Load<AudioStream>("Audio/SFX/shooting.wav");
|
|
sfxPlayer.Stream = audioStream;
|
|
sfxPlayer.Play();
|
|
}
|
|
|
|
public float Speed { get; private set; }
|
|
|
|
public void OnTimeToLiveTimeout()
|
|
{
|
|
QueueFree();
|
|
}
|
|
}
|