/// <summary>
 /// Plays a SoundSpawn.
 /// </summary>
 /// <param name="source">The SoundSpawn to be played</param>
 /// <param name="polyphonic">Should the sound be played polyphonically</param>
 /// <param name="global">Does everyone will receive the sound our just nearby players</param>
 /// <param name="mixerType">The type of mixer to use</param>
 private void PlaySource(SoundSpawn source, bool polyphonic = false, bool global = true, MixerType mixerType = MixerType.Master)
 {
     if (global == false && PlayerManager.LocalPlayer != null)
     {
         if (((PlayerManager.LocalPlayer.TileWorldPosition().To3Int() - source.transform.position.To2Int().To3Int()).magnitude > 20))
         {
             source.AudioSource.outputAudioMixerGroup = AudioManager.Instance.SFXMuffledMixer;                 //Maybe just not play?
         }
         else
         {
             if (MatrixManager.Linecast(PlayerManager.LocalPlayer.TileWorldPosition().To3Int(),
                                        LayerTypeSelection.Walls, layerMask, source.transform.position.To2Int().To3Int())
                 .ItHit)
             {
                 source.AudioSource.outputAudioMixerGroup = AudioManager.Instance.SFXMuffledMixer;
             }
         }
     }
     if (polyphonic)
     {
         source.PlayOneShot();
     }
     else
     {
         source.PlayNormally();
     }
 }
Beispiel #2
0
    private void PlaySource(SoundSpawn source, bool polyphonic = false, bool Global = true, bool forceMixer = false)
    {
        if (!forceMixer)
        {
            if (!Global &&
                PlayerManager.LocalPlayer != null)

            {
                if (((Vector3)(Vector2)PlayerManager.LocalPlayer.TileWorldPosition() - source.transform.position).magnitude <
                    15f)
                {
                    if (MatrixManager.Linecast((Vector2)PlayerManager.LocalPlayer.TileWorldPosition(),
                                               LayerTypeSelection.Walls, layerMask, source.transform.position).ItHit)
                    {
                        //Logger.Log("MuffledMixer");
                        source.audioSource.outputAudioMixerGroup = soundManager.MuffledMixer;
                    }
                }
                else
                {
                    source.audioSource.outputAudioMixerGroup = soundManager.MuffledMixer;
                }
            }
        }

        if (polyphonic)
        {
            source.PlayOneShot();
        }
        else
        {
            source.PlayNormally();
        }
    }
Beispiel #3
0
 /// <summary>
 /// Plays a SoundSpawn.
 /// </summary>
 /// <param name="source">The SoundSpawn to be played</param>
 /// <param name="polyphonic">Should the sound be played polyphonically</param>
 /// <param name="global">Does everyone will receive the sound our just nearby players</param>
 /// <param name="mixerType">The type of mixer to use</param>
 private void PlaySource(SoundSpawn source, bool polyphonic = false, bool global = true, MixerType mixerType = MixerType.Master)
 {
     if (global == false &&
         PlayerManager.LocalPlayer != null &&
         MatrixManager.Linecast(PlayerManager.LocalPlayer.TileWorldPosition().To3Int(),
                                LayerTypeSelection.Walls, layerMask, source.transform.position.To2Int().To3Int())
         .ItHit)
     {
         source.AudioSource.outputAudioMixerGroup = soundManager.MuffledMixer;
     }
     if (polyphonic)
     {
         source.PlayOneShot();
     }
     else
     {
         source.PlayNormally();
     }
 }
Beispiel #4
0
    private void PlaySource(SoundSpawn source, bool polyphonic = false, bool Global = true, bool forceMixer = false)
    {
        if (!forceMixer)
        {
            if (!Global &&
                PlayerManager.LocalPlayer != null &&
                Physics2D.Linecast(PlayerManager.LocalPlayer.TileWorldPosition(), source.RegisterTile.WorldPositionClient.To2Int(), layerMask))
            {
                source.AudioSource.outputAudioMixerGroup = soundManager.MuffledMixer;
            }
        }

        if (polyphonic)
        {
            source.PlayOneShot();
        }
        else
        {
            source.PlayNormally();
        }
    }
Beispiel #5
0
    private void PlaySource(SoundSpawn source, bool polyphonic = false, bool Global = true, bool forceMixer = false)
    {
        if (!forceMixer)
        {
            if (!Global &&
                PlayerManager.LocalPlayer != null &&
                Physics2D.Linecast(PlayerManager.LocalPlayer.TileWorldPosition(), source.transform.position, layerMask))
            {
                //Logger.Log("MuffledMixer");
                source.audioSource.outputAudioMixerGroup = soundManager.MuffledMixer;
            }
        }

        if (polyphonic)
        {
            source.PlayOneShot();
        }
        else
        {
            source.PlayNormally();
        }
    }