/// <summary>
    /// 获取聚焦的目标和信息
    /// </summary>
    /// <returns></returns>
    public AlignTarget GetCurrentAlignTarget()
    {
        AlignTarget alignTargetTemp = new AlignTarget(alignCamera.GetTarget(), alignCamera.CurrentAngles,
                                                      alignCamera.CurrentDistance, alignCamera.angleRange, alignCamera.distanceRange);

        return(alignTargetTemp);
    }
 protected virtual void OnGUI()
 {
     if (CheckFocusEnter())
     {
         var ray     = targetCamera.ScreenPointToRay(Input.mousePosition);
         var hitInfo = new RaycastHit();
         if (Physics.Raycast(ray, out hitInfo, maxRayDistance, layerMask))
         {
             var alignMark = hitInfo.transform.GetComponent <AlignMarkTarget>();
             if (alignMark)
             {
                 if (IsFocus == false)
                 {
                     defaultAlign = new AlignTarget(alignCamera.GetTarget(), alignCamera.CurrentAngles,
                                                    alignCamera.CurrentDistance, alignCamera.angleRange, alignCamera.distanceRange);
                     IsFocus = true;
                 }
                 alignCamera.AlignVeiwToTarget(alignMark.alignTarget);
             }
         }
     }
     else if (IsFocus && CheckFocusExit())
     {
         alignCamera.AlignVeiwToTarget(defaultAlign);
         IsFocus = false;
     }
 }
Пример #3
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         mouseTranslatePro.SetTranslatePosition(mouseTranslatePro.areaSettings.GetPos());
         aroundAlignCamera.AlignVeiwToTarget(aroundAlignCamera.GetTarget(), angles, distance);
         //aroundAlignCamera.CurrentAngles = angles;
         //aroundAlignCamera.
         //CurrentOffset = Vector3.Lerp(CurrentOffset, targetOffset, damper * Time.deltaTime);
         //aroundAlignCamera.target.position = Vector3.Lerp(aroundAlignCamera.target.position, Center.position, middleDamper * Time.deltaTime);
         //aroundAlignCamera.target.position = Center.position;
     }
 }