using Godot; using Godot.Collections; using System.Collections.Generic; using Newlon.Components; using Newlon.Systems.Effects; public partial class EffectBasedPlayer : Node { [Export] public Array effectsToMap; [Export] public Array streamsToMapTo; private System.Collections.Generic.Dictionary effectToAudioMap = new(); public override void _Ready() { GetParent().EffectStarted += OnEffectStarted; for (int i = 0; i < effectsToMap.Count; i++) { effectToAudioMap.Add(effectsToMap[i], streamsToMapTo[i]); } } public void OnEffectStarted(Effect what) { if (effectToAudioMap.ContainsKey(what) == false) return; AudioSequencer.Play(what.Slot, effectToAudioMap[what]); } }