Пример #1
0
 /// <summary>
 /// Unmutes the sent mixer.
 /// </summary>
 /// <param name="player"></param>
 public void UnMute(MixerPlayer player)
 {
     foreach (Mixer m in mixers)
     {
         if (EnumFlags <MixerPlayer> .HasFlag(m.player, player))
         {
             m.UnMute();
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Plays a Combined sound into one of the mixer groups, will try to find a group that is using the closest pitch.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="sound"></param>
 /// <param name="pitch"></param>
 public void PlaySoundCombined(MixerPlayer player, AudioClip sound, float pitch)
 {
     foreach (Mixer m in mixers)
     {
         if (EnumFlags <MixerPlayer> .HasFlag(m.player, player))
         {
             m.PlayCombinedSound(sound, pitch);
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Will cancel or close any existing sound based on the shortest time left in one of the mixers. Will also adjust the mixer to the desired pitch.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="sound"></param>
 /// <param name="pitch"></param>
 public void PlaySoundOverride(MixerPlayer player, AudioClip sound, float pitch)
 {
     foreach (Mixer m in mixers)
     {
         if (EnumFlags <MixerPlayer> .HasFlag(m.player, player))
         {
             m.OverridePlaySound(sound, pitch);
         }
     }
 }
Пример #4
0
 /// <summary>
 /// Plays the sound in an available mixer with the desired pitch.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="sound"></param>
 /// <param name="pitch"></param>
 public void PlaySound(MixerPlayer player, AudioClip sound, float pitch, bool enableLooping)
 {
     foreach (Mixer m in mixers)
     {
         if (EnumFlags <MixerPlayer> .HasFlag(m.player, player))
         {
             m.PlaySound(sound, pitch, enableLooping);
         }
     }
 }
Пример #5
0
 /// <summary>
 /// Adds an outside audio source to the desired player to provide control over that source.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="source"></param>
 public void AddAudioSourceToMixer(MixerPlayer player, AudioSource source)
 {
     foreach (Mixer m in mixers)
     {
         if (EnumFlags <MixerPlayer> .HasFlag(m.player, player))
         {
             m.AddSource(source);
             return;
         }
     }
 }
Пример #6
0
 /// <summary>
 /// Returns the mixer that is associate with that player.
 /// </summary>
 /// <param name="player"></param>
 /// <returns></returns>
 public Mixer GetMixer(MixerPlayer player)
 {
     foreach (Mixer m in mixers)
     {
         if (EnumFlags <MixerPlayer> .HasFlag(m.player, player))
         {
             return(m);
         }
     }
     return(null);
 }
Пример #7
0
 /// <summary>
 /// Stops all other mixer channels sounds over the sent time and plays the AudioClip at the designated pitch and allows looping.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="sound"></param>
 /// <param name="pitch"></param>
 /// <param name="seconds"></param>
 public void TransitionSound(MixerPlayer player, AudioClip sound, float pitch, float seconds, bool enableLooping)
 {
     foreach (Mixer m in mixers)
     {
         if (EnumFlags <MixerPlayer> .HasFlag(m.player, player))
         {
             AudioSource[] sources = m.MuteAllOverlayPlaySound(sound, pitch, enableLooping);
             foreach (AudioSource source in sources)
             {
                 StartCoroutine(MuteSourceOverTime(source, seconds));
             }
         }
     }
 }
Пример #8
0
        /// <summary>
        /// Adjusts the volume of the sent mixer.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="volumeLevel"></param>
        public void AdjustVolume(MixerPlayer player, float volumeLevel)
        {
            if (EnumFlags <MixerPlayer> .HasAllFlags(player, MixerPlayer.Dialog, MixerPlayer.Explosions, MixerPlayer.Instantiations, MixerPlayer.Interactions, MixerPlayer.Movement, MixerPlayer.Music))
            {
                AdjustMasterVolume(volumeLevel);
                return;
            }

            foreach (Mixer m in mixers)
            {
                if (EnumFlags <MixerPlayer> .HasFlag(m.player, player))
                {
                    m.AdjustVolume(volumeLevel);
                }
            }
        }
        public PlayerPositionAndLookPacket(MemoryStream ms)
        {
            X = ms.ReadDouble();
            Y = ms.ReadDouble();
            Z = ms.ReadDouble();

            Yaw   = ms.ReadFloat();
            Pitch = ms.ReadFloat();

            Flags = (EnumFlags)((int)ms.ReadByte());

            TeleportId = ms.ReadVarInt();

            // Fix MC x
            if (Flags.HasFlag(EnumFlags.X))
            {
                X = -X;
            }
            else
            {
                X = MCHelper.FixAbsoluteX(X);
            }
        }