using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using UnityEngine.EventSystems; public class ChuanSongMen : MonoBehaviour { /// /// 门的类型 /// public int doorType = 1; /// /// 出生时间 /// public float liveTime = 2.0f; /// /// 点击回调 /// public Action clickAC = null; /// /// 进入碰撞器回调 /// public Action enterAC = null; private bool bEnable = false; private void OnEnable() { Invoke("LateEnable", liveTime); } private void LateEnable() { bEnable = true; } private void OnMouseUpAsButton() { Debug.Log("点击触发器"); if (bEnable == false) { return; } if (clickAC != null) { clickAC(doorType); } } private void OnTriggerEnter(Collider other) { Debug.Log("进入到触发器 " + other.name); if (bEnable == false) { return; } if (enterAC != null) { enterAC(doorType, other.gameObject); } } }