[RequireComponent(typeof(AudioSource))]
public class CsMissile : MonoBehaviour {
public AudioClip sndExp;
float speed = 50.0f;
// Use this for initialization
void Start() {
Destroy(gameObject, 1);
}
// Update is called once per frame
void Update () {
float amtMove = speed * Time.smoothDeltaTime;
transform.Translate (Vector3.forward * amtMove);
if ( transform.position.z > 250) {
Destroy (gameObject);
}
}
void OnTriggerEnter(Collider coll) {
Debug.Log ("Trigger enter");
AudioSource audio = GetComponent<AudioSource> ();
audio.Play ();
if (coll.tag == "WALL") {
Destroy (coll.gameObject);
}
Destroy (gameObject);
if (coll.tag == "WALL")
{
}
}
}
저렇게 코딩을 해 놨는데 WALL에 부딪치고 WALL이 터질때 폭발 사운드를 넣고싶어요 어떻게 코딩을 해야하나요...?
coll.tag == "WALL" 조건 밑에 여기에 쓰면 되겠네
감사합니다 ㅠㅠ