MVH/Scripts/Game/AudioManager.cs
2024-06-07 00:47:07 +02:00

39 lines
543 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AudioManager : MonoBehaviour
{
[HideInInspector]
public AudioClip Clip { get; set; }
public AudioSource source;
[Range(0f, 1f)]
public float volume;
[Range(0f, 1f)]
public float pitch;
void Awake()
{
source = GetComponent<AudioSource>();
source.clip = Clip;
}
public void UpdateClip(AudioClip clip)
{
source.clip = clip;
}
public void Play()
{
source.Play();
}
public void Stop()
{
source.Stop();
}
}