void OnTriggerEnter(Collider other)
{
if(other.gameObject.name != "Player") return; //skips the rest of the function if something else entered the trigger besides what we want to actually trigger the event
StartCoroutine(MyCoroutine());
}
IEnumerator MyCoroutine()
{
//disable the desired script here //关闭
yield return new WaitForSeconds(10F);//等待10s
//enable it here//再打开
}