25 lines
782 B
C#
25 lines
782 B
C#
using Godot;
|
|
using Godot.Collections;
|
|
|
|
namespace Scripts;
|
|
|
|
public partial class SoundManager : Node {
|
|
[Export] private AudioStreamPlayer3D explosionSound;
|
|
[Export] private AudioStreamPlayer backgroundMusic;
|
|
[Export] private AudioStreamPlayer3D laserSound;
|
|
public static SoundManager Instance { get; private set; }
|
|
|
|
public override void _Ready() => Instance = this;
|
|
|
|
public void PlayExplosion(Vector3 position) {
|
|
explosionSound.Position = position;
|
|
explosionSound.PitchScale = (float)GD.RandRange(0.25f, 1.75f);
|
|
explosionSound.Play();
|
|
}
|
|
|
|
public void PlayLaserSound(Vector3 position) {
|
|
laserSound.Position = position;
|
|
laserSound.PitchScale = (float)GD.RandRange(0.25f, 1.75f);
|
|
laserSound.Play();
|
|
}
|
|
} |