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