Ejemplo n.º 1
0
 protected virtual void OnGUI()
 {
     if (CheckFocusEnter())
     {
         var ray     = targetCamera.ScreenPointToRay(Input.mousePosition);
         var hitInfo = new RaycastHit();
         if (Physics.Raycast(ray, out hitInfo, maxDistance, layerMask))
         {
             var alignMark = hitInfo.transform.GetComponent <AlignMark>();
             if (alignMark)
             {
                 if (IsFocus == false)
                 {
                     defaultAlign = new AlignTarget(alignCamera.target, alignCamera.CurrentAngles,
                                                    alignCamera.CurrentDistance, alignCamera.angleRange, alignCamera.distanceRange);
                     IsFocus = true;
                 }
                 alignCamera.AlignVeiwToTarget(alignMark.alignTarget);
             }
         }
     }
     else if (IsFocus && CheckFocusExit())
     {
         alignCamera.AlignVeiwToTarget(defaultAlign);
         IsFocus = false;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Align camera 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));
 }