EffectBasedPlayer channel settings
This commit is contained in:
parent
e527d1da44
commit
9820eb9445
2 changed files with 13 additions and 4 deletions
|
|
@ -8,20 +8,22 @@ public partial class EffectBasedPlayer : Node
|
|||
{
|
||||
[Export] public Array<Effect> effectsToMap;
|
||||
[Export] public Array<AudioStream> streamsToMapTo;
|
||||
private System.Collections.Generic.Dictionary<Effect, AudioStream> effectToAudioMap = new();
|
||||
[Export] public Array<ChannelSettings> streamSettings;
|
||||
private System.Collections.Generic.Dictionary<Effect, (AudioStream,ChannelSettings)> effectToAudioMap = new();
|
||||
public override void _Ready()
|
||||
{
|
||||
GetParent<Entity>().EffectStarted += OnEffectStarted;
|
||||
|
||||
for (int i = 0; i < effectsToMap.Count; i++)
|
||||
{
|
||||
effectToAudioMap.Add(effectsToMap[i], streamsToMapTo[i]);
|
||||
effectToAudioMap.Add(effectsToMap[i], (streamsToMapTo[i],streamSettings[i]));
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEffectStarted(Effect what)
|
||||
{
|
||||
if (effectToAudioMap.ContainsKey(what) == false) return;
|
||||
AudioSequencer.Play(what.Slot, effectToAudioMap[what]);
|
||||
AudioSequencer.Play(what.Slot, effectToAudioMap[what].Item1);
|
||||
AudioSequencer.ChangeSettings(what.Slot, effectToAudioMap[what].Item2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue