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); //播放作业票内容
}
}
抓取代码
最新推荐文章于 2024-06-17 16:55:09 发布