void Update() { Ray tempRay = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(tempRay, out hit, 2000)) { PointCenterAxis tempPCA = hit.collider.GetComponent <PointCenterAxis>(); PointAxis tempPA = hit.collider.GetComponent <PointAxis>(); if (Input.GetKeyDown(KeyCode.Mouse0)) { if (null != tempPCA) { Reset_SelectedState(); PCA = tempPCA; PCA.IsBeSelected = true; } else if (null != tempPA) { Reset_SelectedState(); PA = tempPA; PA.isBeSelected = true; } } } if (Input.GetKeyUp(KeyCode.Mouse0)) { Reset_SelectedState(); } }
/// <summary> /// 重置数据 /// </summary> private void Reset_SelectedState() { if (null != PCA) { PCA.IsBeSelected = false; PCA = null; } if (null != PA) { PA.isBeSelected = false; PA = null; } }