public virtual void TabTargetUpdatePointClickInput() { if (controllerMode == PlayerCharacterControllerMode.WASD) { return; } // If it's building something, not allow point click movement if (ConstructingBuildingEntity != null) { return; } // If it's aiming skills, not allow point click movement if (UICharacterHotkeys.UsingHotkey != null) { return; } getMouseDown = Input.GetMouseButtonDown(0); getMouseUp = Input.GetMouseButtonUp(0); getMouse = Input.GetMouseButton(0); if (getMouseDown) { isMouseDragOrHoldOrOverUI = false; mouseDownTime = Time.unscaledTime; mouseDownPosition = Input.mousePosition; } // Read inputs isPointerOverUI = CacheUISceneGameplay.IsPointerOverUIObject(); isMouseDragDetected = (Input.mousePosition - mouseDownPosition).sqrMagnitude > DETECT_MOUSE_DRAG_DISTANCE_SQUARED; isMouseHoldDetected = Time.unscaledTime - mouseDownTime > DETECT_MOUSE_HOLD_DURATION; isMouseHoldAndNotDrag = !isMouseDragDetected && isMouseHoldDetected; if (!isMouseDragOrHoldOrOverUI && (isMouseDragDetected || isMouseHoldDetected || isPointerOverUI)) { // Detected mouse dragging or hold on an UIs isMouseDragOrHoldOrOverUI = true; } // Will set move target when pointer isn't point on an UIs if (!isPointerOverUI && (getMouse || getMouseUp)) { didActionOnTarget = false; // Prepare temp variables Transform tempTransform; Vector3 tempVector3; bool tempHasMapPosition = false; Vector3 tempMapPosition = Vector3.zero; BuildingMaterial tempBuildingMaterial; // If mouse up while cursor point to target (character, item, npc and so on) bool mouseUpOnTarget = getMouseUp && !isMouseDragOrHoldOrOverUI; int tempCount = TabTargetFindClickObjects(out tempVector3); for (int tempCounter = 0; tempCounter < tempCount; ++tempCounter) { tempTransform = physicFunctions.GetRaycastTransform(tempCounter); // When holding on target, or already enter edit building mode if (isMouseHoldAndNotDrag) { targetBuilding = null; tempBuildingMaterial = tempTransform.GetComponent <BuildingMaterial>(); if (tempBuildingMaterial != null) { targetBuilding = tempBuildingMaterial.BuildingEntity; } if (targetBuilding && !targetBuilding.IsDead()) { Targeting.Target(targetBuilding.gameObject); break; } } else if (mouseUpOnTarget) { isAutoAttacking = false; if (tempTransform.gameObject.GetComponent <BaseGameEntity>() == CacheSelectedTarget) { Activate(); } else { Targeting.UnHighlightPotentialTarget(); Targeting.Target(tempTransform.gameObject); } } // End mouseUpOnTarget } // When clicked on map (Not touch any game entity) // - Clear selected target to hide selected entity UIs // - Set target position to position where mouse clicked if (tempHasMapPosition) { targetPosition = tempMapPosition; } // When clicked on map (any non-collider position) // tempVector3 is come from FindClickObjects() // - Clear character target to make character stop doing actions // - Clear selected target to hide selected entity UIs // - Set target position to position where mouse clicked if (CurrentGameInstance.DimensionType == DimensionType.Dimension2D && mouseUpOnTarget && tempCount == 0) { ClearTarget(); tempVector3.z = 0; targetPosition = tempVector3; } // Found ground position if (targetPosition.HasValue) { // Close NPC dialog, when target changes HideNpcDialog(); ClearQueueUsingSkill(); isFollowingTarget = false; if (PlayerCharacterEntity.IsPlayingActionAnimation()) { if (pointClickInterruptCastingSkill) { PlayerCharacterEntity.CallServerSkillCastingInterrupt(); } } else { OnPointClickOnGround(targetPosition.Value); } } } }