ReserveSoundID() static private method

static private ReserveSoundID ( SoundType type ) : int
type SoundType
return int
Ejemplo n.º 1
0
        public void AddSound(SoundType type, string soundPath, ModSound modSound = null)
        {
            int id = SoundLoader.ReserveSoundID(type);

            SoundLoader.sounds[type][soundPath] = id;
            if (modSound != null)
            {
                SoundLoader.modSounds[type][id] = modSound;
                modSound.sound = ModLoader.GetSound(soundPath);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds the given sound file to the game as the given type of sound and with the given custom sound playing. If no ModSound instance is provided, the custom sound will play in a similar manner as the default vanilla ones.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="soundPath">The sound path.</param>
        /// <param name="modSound">The mod sound.</param>
        public void AddSound(SoundType type, string soundPath, ModSound modSound = null)
        {
            if (!loading)
            {
                throw new Exception("AddSound can only be called from Mod.Load or Mod.Autoload");
            }

            int id = SoundLoader.ReserveSoundID(type);

            SoundLoader.sounds[type][soundPath] = id;

            if (modSound != null)
            {
                SoundLoader.modSounds[type][id] = modSound;

                modSound.Sound = ModContent.GetSound(soundPath);
            }
        }