-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSFXBridge.cs
More file actions
50 lines (40 loc) · 1.17 KB
/
Copy pathSFXBridge.cs
File metadata and controls
50 lines (40 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using Core;
using Godot;
namespace Audio
{
/// <summary>
/// Autoload singleton accessible at /root/SFXBridge
/// </summary>
public partial class SFXBridge : Node
{
private CameraBridge cameraBridge;
private Node sfxNode;
private Node sfx2dNode;
public override void _Ready()
{
cameraBridge = GetNode<CameraBridge>("/root/CameraBridge");
sfxNode = GetNode("/root/SFX");
sfx2dNode = GetNode("/root/SFX2D");
}
public void Play(string soundGroupName)
{
sfxNode?.Call("play", soundGroupName);
}
public void PlaySound(string soundGroupName)
{
PlaySound(soundGroupName, cameraBridge.MainCamera.GlobalPosition);
}
public void PlaySound(string soundGroupName, Vector3 location)
{
sfxNode?.Call("play_sound", soundGroupName, location);
}
public void Play2D(string name)
{
sfx2dNode?.Call("play_sound", name);
}
public void SetMainCamera(Camera3D camera)
{
sfxNode?.Call("set_main_camera", camera);
}
}
}