Slide 10
Slide 10 text
ෳͷԻΛग़͢
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TripleSound : MonoBehaviour {
public AudioClip enemySE;
public AudioClip stoneSE;
public AudioClip wallSE;
private AudioSource audioSource;
void Start() {
audioSource = GetComponent();
}
void OnTriggerEnter(Collider other) {
if (other.gameObject.tag == "enemy") {
audioSource.PlayOneShot(enemySE);
} else if (other.gameObject.tag == "stone") {
audioSource.PlayOneShot(stoneSE);
} else {
audioSource.PlayOneShot(wallSE);
}
}
}