Пример #1
0
 /// <summary>
 /// The view type has changed.
 /// </summary>
 /// <param name="activate">Should the current view type be activated?</param>
 /// <param name="pitch">The pitch of the camera (in degrees).</param>
 /// <param name="yaw">The yaw of the camera (in degrees).</param>
 /// <param name="characterRotation">The rotation of the character.</param>
 public override void ChangeViewType(bool activate, float pitch, float yaw, Quaternion characterRotation)
 {
     if (activate)
     {
         m_Pitch             = pitch;
         m_Yaw               = yaw;
         m_CharacterRotation = characterRotation;
         if (m_CharacterLocomotion.Platform != null)
         {
             UpdatePlatformRotationOffset(m_CharacterLocomotion.Platform);
         }
         if (m_Camera.fieldOfView != m_FieldOfView)
         {
             m_FieldOfViewChangeTime = Time.time + m_FieldOfViewDamping / m_CharacterLocomotion.TimeScale;
         }
         if (m_StepZoomSensitivity > 0)
         {
             if (m_Handler != null)
             {
                 m_StepZoomInputEvent = ObjectPool.Get <ActiveInputEvent>();
                 m_StepZoomInputEvent.Initialize(ActiveInputEvent.Type.Axis, m_StepZoomInputName, "OnThirdPersonViewTypeStepZoom");
                 m_Handler.RegisterInputEvent(m_StepZoomInputEvent);
             }
             EventHandler.RegisterEvent <float>(m_GameObject, "OnThirdPersonViewTypeStepZoom", OnStepZoom);
         }
     }
     else
     {
         if (m_StepZoomSensitivity > 0)
         {
             if (m_Handler != null)
             {
                 m_StepZoomInputEvent = ObjectPool.Get <ActiveInputEvent>();
                 m_Handler.UnregisterAbilityInputEvent(m_StepZoomInputEvent);
                 ObjectPool.Return(m_StepZoomInputEvent);
             }
             EventHandler.UnregisterEvent <float>(m_GameObject, "OnThirdPersonViewTypeStepZoom", OnStepZoom);
         }
     }
 }
Пример #2
0
        /// <summary>
        /// The view type has changed.
        /// </summary>
        /// <param name="activate">Should the current view type be activated?</param>
        /// <param name="pitch">The pitch of the camera (in degrees).</param>
        /// <param name="yaw">The yaw of the camera (in degrees).</param>
        /// <param name="characterRotation">The rotation of the character.</param>
        public override void ChangeViewType(bool activate, float pitch, float yaw, Quaternion characterRotation)
        {
            base.ChangeViewType(activate, pitch, yaw, characterRotation);

            if (activate)
            {
                m_Pitch             = pitch;
                m_Yaw               = yaw;
                m_CharacterRotation = characterRotation;
                if (m_CharacterLocomotion.Platform != null)
                {
                    UpdatePlatformRotationOffset(m_CharacterLocomotion.Platform);
                }
                if (m_StepZoomSensitivity > 0)
                {
                    if (m_Handler != null)
                    {
                        m_StepZoomInputEvent = GenericObjectPool.Get <ActiveInputEvent>();
                        m_StepZoomInputEvent.Initialize(ActiveInputEvent.Type.Axis, m_StepZoomInputName, "OnThirdPersonViewTypeStepZoom");
                        m_Handler.RegisterInputEvent(m_StepZoomInputEvent);
                    }
                    EventHandler.RegisterEvent <float>(m_GameObject, "OnThirdPersonViewTypeStepZoom", OnStepZoom);
                }
            }
            else
            {
                if (m_StepZoomSensitivity > 0)
                {
                    if (m_Handler != null)
                    {
                        m_StepZoomInputEvent = GenericObjectPool.Get <ActiveInputEvent>();
                        m_Handler.UnregisterAbilityInputEvent(m_StepZoomInputEvent);
                        GenericObjectPool.Return(m_StepZoomInputEvent);
                    }
                    EventHandler.UnregisterEvent <float>(m_GameObject, "OnThirdPersonViewTypeStepZoom", OnStepZoom);
                }
            }
        }