public AudioClip audioSuccess;

public AudioClip audioFail;

// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.M))
    {
        AudioSource audioSource = GetComponent<AudioSource>();
        audioSource.PlayOneShot(audioSuccess);
    }
    else if (Input.GetKeyDown(KeyCode.N))
    {
        AudioSource audioSource = GetComponent<AudioSource>();
        audioSource.PlayOneShot(audioFail);
    }
}

user_8rb1Zsgt
1 声望0 粉丝

引用和评论

0 条评论