public class ZhuaZuoYePiao : MonoBehaviour {
public bool IsOnce = true;
public GameObject daimaoren;
public GameObject zuoyepiao;
void OnTriggerEnter(Collider other)
{ //抓取物体,把被抓物体归为子物体
if (other.tag == "zuoyepiao")
{
other.transform.parent = this.gameObject.transform; //把作业票作为手柄的子物体
other.transform.localPosition = Vector3.zero; //把作业票的自身位置归0,0,0;
//解除物体之间的父子关系
// other.gameObject.transform.parent.
SoundController._instance.SetAudio(AudioClipType.duzuoyepiao); //播放作业票内容
}
}
void Update()
{
if (SoundController._instance.audioSource.clip == SoundController._instance.audioClips[(int)AudioClipType.duzuoyepiao]) //判断当前播放的是不是作业票内容
{
if (!SoundController._instance.audioSource.isPlaying) //判断作业票内容是否播放完毕
{
Debug.Log("带帽人高亮显示");
Destroy(zuoyepiao);
}
}
}
}
判断当前音效是否播放完毕
最新推荐文章于 2024-06-05 15:10:41 发布