コード例 #1
0
    public void PlayAudio(audioClips state)
    {
        switch (state)
        {
        case audioClips.hit:
            GetComponent<AudioSource>().clip = clips[0];
            break;
        case audioClips.miss:
            GetComponent<AudioSource>().clip = clips[1];
            break;
        case audioClips.ai:
            GetComponent<AudioSource>().PlayOneShot(clips[2]);
            break;
        }

        GetComponent<AudioSource> ().Play ();
    }