Ejemplo n.º 1
0
 protected virtual void OnGUI()
 {
     if (CheckFocusEnter())
     {
         var        ray = targetCamera.ScreenPointToRay(Input.mousePosition);
         RaycastHit hitInfo;
         if (Physics.Raycast(ray, out hitInfo, maxDistance, layerMask))
         {
             var alignMark = hitInfo.transform.GetComponent <AlignMark>();
             if (alignMark)
             {
                 if (isFocus == false)
                 {
                     isFocus      = true;
                     defaultAlign = new AlignTarget(alignCamera.target, alignCamera.currentAngles,
                                                    alignCamera.currentDistance, alignCamera.angleRange, alignCamera.distanceRange);
                 }
                 alignCamera.AlignVeiwToTarget(alignMark.alignTarget);
             }
         }
     }
     else if (isFocus && CheckFocusExit())
     {
         isFocus = false;
         alignCamera.AlignVeiwToTarget(defaultAlign);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Align camera's veiw to target.
        /// </summary>
        /// <param name="alignTarget">Target of camera align.</param>
        public void AlignVeiwToTarget(AlignTarget alignTarget)
        {
            AlignVeiwToTarget(alignTarget.center, alignTarget.angles, alignTarget.distance);

            //Override range.
            angleRange    = alignTarget.angleRange;
            distanceRange = alignTarget.distanceRange;
        }
Ejemplo n.º 3
0
 private void AlignCameraToMark(AlignMark alignMark)
 {
     if (isAlign == false)
     {
         isAlign      = true;
         defaultAlign = new AlignTarget(alignCamera.target, alignCamera.currentAngles,
                                        alignCamera.currentDistance, alignCamera.angleRange, alignCamera.distanceRange);
     }
     alignCamera.AlignVeiwToTarget(alignMark.alignTarget);
 }
Ejemplo n.º 4
0
 protected virtual void Reset()
 {
     //Reset align target.
     alignTarget = new AlignTarget(transform, new Vector2(30, 0), 5, new Range(-90, 90), new Range(1, 10));
 }