using UnityEngine;
using System.Collections;
public class Wall : MonoBehaviour {
public GameObject BulletSpark;
public AudioClip wallHit;
void OnCollisionEnter(Collision Col)
{
if(Col.transform.tag == "Bullet")
{
audio.clip = wallHit;
audio.Play();
GameObject newSpark = Instantiate(BulletSpark,Col.transform.position,Quaternion.LookRotation(-Col.transform.position))as GameObject; //spark position : back -> front
Destroy(newSpark,8.0f);
Destroy(Col.gameObject);
}
}
}
'유니티3D > 예제' 카테고리의 다른 글
gamemanagel.cs (0) | 2013.08.26 |
---|---|
powercell.cs (0) | 2013.08.26 |
All Script in ThirdPersonShooingGame (0) | 2013.08.23 |
plane size 동적할당 (0) | 2013.08.21 |
HPBar (0) | 2013.08.20 |