mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-11-26 07:18:00 +01:00
28 lines
488 B
C#
28 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;
|
|
}
|
|
}
|
|
}
|
|
}
|