/// <summary> /// 是否需要移动摄像机以适应当前点的焦点显示 /// </summary> /// <param name="targetPos"></param> /// <returns></returns> public bool IsTargetInHalfView(Vector2Int targetPos) { var focusPos = PositionMath.CameraTilePositionFocusOnLocalPosition(targetPos); var diffViewPos = focusPos - transform.localPosition; float l = PositionMath.CameraTileLength * STAY_DISTANCE; if (Mathf.Abs(diffViewPos.x) >= l || Mathf.Abs(diffViewPos.y) >= l) { return(false); } return(true); }
public void CameraMoveTo(Vector2Int tilePos, UnityAction onComplete, float moveTime = 0.0f, bool accelerate = false) { if (moveTime < 0.01f) { PositionMath.SetCameraFocusPosition(MainCameraTransform, tilePos); } else { var targetPosition = PositionMath.CameraTilePositionFocusOnLocalPosition(tilePos); Tweener tw = MainCameraTransform.DOLocalMove(targetPosition, moveTime); if (onComplete != null) { tw.OnComplete(() => onComplete()); } } }