gpt4 book ai didi

c# - 声音未添加到字典容器

转载 作者:行者123 更新时间:2023-12-03 02:15:02 26 4
gpt4 key购买 nike

我正在XNA中制作声音,我想将它们添加到词典中,以便可以随时存储和调用它们。例如,存储一个跳跃声音,在播放器类中跳跃时调用它。

这是代码:

this.soundEffectInfo = new SoundEffectInfo(this, "BackgroundSound", "Assets\\Sounds\\RaceSound", 0.9f, 20, 20, true);

soundManager.add(soundEffectInfo);
soundEffectInfo.SOUNDEFFECT.Play();

this.soundEffectInfo = new SoundEffectInfo(this, "JumpSound", "Assets\\Sounds\\JumpSound", 0.9f, 20, 20, true);
soundManager.add(soundEffectInfo);
soundEffectInfo是一个 SoundEffectInfo对象,它接受 SoundEffectInstanceSoundManager是这些实例的类容器。

我得到的错误是:

An unhandled exception of type 'System.NullReferenceException' occurred in RATEV2.exe
Additional information: Object reference not set to an instance of an object.

最佳答案

闻起来就像您没有引用字典一样。

关于c# - 声音未添加到字典容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20752572/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com