Пример #1
0
    private void HandleFogAudio()
    {
        // Track player distance from fog wall
        var distance = Vector2.Distance(_player.transform.position, transform.position);

        _audioSource.volume = AudioUtility.GetDynamicVolumeUsingDistance(
            distance: distance,
            maxDistance: _startSmallFaces,
            minDistance: _startBigFaceOpen,
            minVolume: _minFogVolume,
            maxVolume: _maxFogVolume
            );

        if (!_audioSource.isPlaying)
        {
            _audioSource.Play();
        }
    }