public void ReactiveBoxCollider() { Debug.Log("重新开启碰撞器"); GetComponent <BoxCollider>().enabled = true; //移除自身委托事件 GamePanelController ui = GameObject.Find("Canvas/GamePanel").GetComponent <GamePanelController>(); ui.onBackFormLookAt.RemoveListener(ReactiveBoxCollider); }
void OnTriggerEnter(Collider collider) { //进入触发器执行的代码 if (collider.gameObject.name == "FirstPerson") { if (GamePanelController.gameEnd != null) { GamePanelController.gameEnd(); } } }
public override void BeUse(RaycastHit hitInfo) { //如果被解开了就不能再被use if (state) { return; } //注视动作 PlayerController.Instance.LookAt(CameraPos.position, CameraPos.rotation, LookType.HuarongPuzzle); //找到ui GamePanelController ui = GameObject.Find("Canvas/GamePanel").GetComponent <GamePanelController>(); //调用方法显示回退按钮 ui.ShowBackFromLookAtButton(); //添加事件 ui.onBackFormLookAt.AddListener(ReactiveBoxCollider); //关闭collider transform.GetComponent <BoxCollider>().enabled = false; }