/// <summary> /// 检测是否关闭建筑 /// </summary> private void CloseBuildingCheck() { if (!IsBuildingOpen) { return; } if (BuildingController.isTweening || IsClickUGUIorNGUI.Instance.isOverUI) { return; } if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit[] hitInfo = Physics.RaycastAll(ray, float.MaxValue); bool value = false; for (int i = 0; i < hitInfo.Length; i++) { FloorController floor = hitInfo[i].transform.GetComponent <FloorController>(); BuildingFloor topFloor = hitInfo[i].transform.GetComponent <BuildingFloor>(); if (floor != null || topFloor != null) { value = true; break; } } if (!value) { if (FactoryDepManager.currentDep is BuildingController) { BuildingController controller = FactoryDepManager.currentDep as BuildingController; controller.CloseFloor(); } } } }
/// <summary> /// 单击关闭楼层 /// </summary> private void CloseBuilding() { if (ParentNode && ParentNode as BuildingController) { BuildingController controller = ParentNode as BuildingController; if (BuildingController.isTweening) { return; } controller.CloseFloor(false); } }