//射线函数,返回碰撞到的物体,没有返回null Transform MyRay(Camera camera, int mission_Index) { //当前界面不是主界面,返回 if (MainUITool.Instance.TheActiveStack.Peek() != WindowID.WindowID_MainMenu) { return(null); } Ray ray = camera.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity, 1 << LayerMask.NameToLayer("Mission"))) { //判断当前是否是解锁关卡 MissionMark current_Mission = hit.transform.GetComponent <MissionMark>(); if (!current_Mission.IsLock) { return(null); } //点击当前导航关卡,才会加载界面 if (hit.transform.name == mission_Index.ToString()) { UIManager.MissionName = hit.transform.name; MyKeys.MissionName = new StringBuilder(hit.transform.name); return(hit.transform); } else { return(null); } } else { return(null); } }
protected override void Start() { missionMark = GetComponentInChildren <MissionMark> (); base.Start(); LeeDialogo(); }