Beispiel #1
0
        /// <summary>
        ///     At each update, the camera will place itself behind the player
        ///     and rotate according the mouse movements
        /// </summary>
        public override void UpdateWithMouseAxis(MouseAxis axis)
        {
            //calculate the camera angle
            _angleX += axis.horizontal * _horizontalSensitivity;
            _angleY += (-axis.vertical) * _verticalSensitivity;

            _angleY = Mathf.Clamp(_angleY, 2f, 80f);

            //execute the move
            Vector3    direction = new Vector3(0, 0, -_spaceBehindObject);
            Quaternion rotation  = Quaternion.Euler(_angleY, _angleX, 0);

            _cameraTransform.position = _target.position + rotation * direction;
            //the camera must look at the object after it moves
            _cameraTransform.LookAt(_target.position + _aimOffset);
        }
Beispiel #2
0
 public void Start()
 {
     _currentMouseAxis = new MouseAxis();
 }
Beispiel #3
0
 /// <summary>
 ///     Update the current character according to the mouse input
 /// </summary>
 public override void UpdateWithMouseAxis(MouseAxis mouseAxis)
 {
     _cameraRotator.UpdateWithMouseAxis(mouseAxis);
     _simpleMovement.UpdateMovement(_cameraTransform.forward, _cameraTransform.right);
 }
Beispiel #4
0
 public abstract void UpdateWithMouseAxis(MouseAxis mouseAxis);