mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-27 20:13:00 +00:00
27 lines
605 B
C#
27 lines
605 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace RhythmHeavenMania.Util
|
|
{
|
|
public class Sound : MonoBehaviour
|
|
{
|
|
public AudioClip clip;
|
|
public float pitch;
|
|
|
|
private AudioSource audioSource;
|
|
|
|
private void Start()
|
|
{
|
|
audioSource = GetComponent<AudioSource>();
|
|
audioSource.PlayOneShot(clip);
|
|
StartCoroutine(play());
|
|
}
|
|
|
|
private IEnumerator play()
|
|
{
|
|
yield return new WaitForSeconds(clip.length);
|
|
Destroy(this.gameObject);
|
|
}
|
|
}
|
|
}
|