public void DoUpdate(float deltaTime) { vecLastMousePos = vecMousePos; vecMousePos = Input.mousePosition; if (Input.GetMouseButtonUp(0)) { bIsMouseLeftDown = false; if (vecMouseLeftPressPos.SqrDistanceWith(vecMousePos) < 1 && fMouseLeftPressTime < 1.5f) { RaycastHit hit; if (Physics.Raycast(MainCamera.CameraWorld.ScreenPointToRay(vecMousePos), out hit, 10000, 1 << LayerMask.NameToLayer("Accessable"))) { InteractiveObj interactiveObj = hit.collider.GetComponent <InteractiveObj>(); if (interactiveObj) { interactiveObj.ClickObj(); OnClickInteractiveObj.Invoke(interactiveObj); } } else if (Physics.Raycast(MainCamera.CameraWorld.ScreenPointToRay(vecMousePos), out hit, 1 << LayerMask.NameToLayer("Ground"))) { OnClickGround.Invoke(hit.point); } } MainCamera.OnPress(false); } if (Input.GetMouseButtonUp(1)) { bIsMouseRightDown = false; } if (bIsMouseLeftDown || bIsMouseRightDown) { if (bIsMouseLeftDown) { fMouseLeftPressTime += deltaTime; } if (bIsMouseRightDown) { fMouseRightPressTime += deltaTime; } Vector2 delta = vecMousePos - vecLastMousePos; if (delta.x != 0 || delta.y != 0) { MainCamera.OnDrag(delta); } } if (Input.GetMouseButtonDown(0) && !bIsMouseRightDown && !UISystem.Instance.IsMouseOnUI()) { bIsMouseLeftDown = true; fMouseLeftPressTime = 0; vecMouseLeftPressPos = vecMousePos; MainCamera.OnPress(true); } if (Input.GetMouseButtonDown(1) && !bIsMouseLeftDown && !UISystem.Instance.IsMouseOnUI()) { bIsMouseRightDown = true; fMouseRightPressTime = 0; vecMouseRightPressPos = vecMousePos; MainCamera.OnPress(true); } MainCamera.DoUpdate(deltaTime); }