加载声音效果和声音效果实例后出错


ExplosionSound = Content.Load<SoundEffect>("explosion");
            ExplosionSoundInstance = ExplosionSound.CreateInstance();

上面代码的最后一行带有下划线,我收到一个错误,指出:"无法将类型'Microsoft.Xna.Framework.Audio.SoundEffectInstance'隐式转换为Microsoft.Xna.Framework.Audio.SoundEffect"。

帮助将不胜感激,谢谢。

看起来好像你被声明为SoundEffect的ExplosionSoundInstance...

将其声明为 SoundEffectInstance...。

SoundEffectInstance ExplosionSoundInstance;

最新更新