当 OnCollisionEnter 函数启动时,我播放了 2 个音频剪辑,我还想在发生碰撞的位置显示一个粒子系统。
这是代码;
private var beenHit : boolean = false;
private var targetRoot : Animation;
var hitSound : AudioClip;
var chitSound : AudioClip;
var resetSound : AudioClip;
var resetTime : float = 3.0;
var dieEffectsPrefab : Transform;
public ParticleSystem DestructionEffect;
function OnCollisionEnter() {
audio.PlayOneShot(chitSound);
audio.PlayOneShot(hitSound);
Debug.Log("HitSomething");
animation.CrossFade ("dying");
Destroy(gameObject,1);
}