39 lines
543 B
C#
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();
|
||
|
}
|
||
|
}
|