mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-11-30 00:48:00 +01:00
29 lines
488 B
C#
29 lines
488 B
C#
|
using UnityEngine;
|
||
|
|
||
|
namespace Fie.Utility
|
||
|
{
|
||
|
public class FieUtilAutoAudioTimeScaler : MonoBehaviour
|
||
|
{
|
||
|
private float _defaultPitch = 1f;
|
||
|
|
||
|
private AudioSource _audioSource;
|
||
|
|
||
|
private void Awake()
|
||
|
{
|
||
|
_audioSource = base.gameObject.GetComponent<AudioSource>();
|
||
|
if (_audioSource != null)
|
||
|
{
|
||
|
_defaultPitch = _audioSource.pitch;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void Update()
|
||
|
{
|
||
|
if (!(_audioSource == null))
|
||
|
{
|
||
|
_audioSource.pitch = _defaultPitch * Time.timeScale;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|