Пример #1
0
        public static void Apply(TrainCarType carType, SoundType soundType, Config.SoundDefinition?soundDefinition, ref AudioClip[] clips)
        {
            var key = new DefaultKey(carType, soundType);

            Main.DebugLog(() => $"Loading {key}: {soundDefinition}");
            if (!Defaults.ContainsKey(key))
            {
                Defaults[key] = new AudioSettings()
                {
                    clips = clips
                }
            }
            ;

            if (soundDefinition != null && (soundDefinition.filenames?.Length ?? 0) > 0)
            {
                clips = soundDefinition.filenames.Select(FileAudio.Load).ToArray();
            }
            else if (soundDefinition?.filename != null)
            {
                clips = new AudioClip[] { FileAudio.Load(soundDefinition.filename) }
            }
            ;
            else
            {
                clips = Defaults[key].clips !;
            }
        }
Пример #2
0
        public static void Apply(TrainCarType carType, SoundType soundType, Config.SoundDefinition?soundDefinition, ref AudioClip clip)
        {
            var key = new DefaultKey(carType, soundType);

            Main.DebugLog(() => $"Loading {key}: {soundDefinition}");
            if (!Defaults.ContainsKey(key))
            {
                Defaults[key] = new AudioSettings()
                {
                    clip = clip
                }
            }
            ;

            if (soundDefinition?.filename != null)
            {
                clip = FileAudio.Load(soundDefinition.filename);
            }
            else
            {
                clip = Defaults[key].clip !;
            }
        }