Beispiel #1
0
        /// <summary>
        /// Creates a game camera and the controls to maneauver it.
        /// </summary>
        /// <param name="options"></param>
        public CameraController(ICameraOptions options)
        {
            _cameraGameObject = CreateCamera();
            Camera            = _cameraGameObject.GetComponent <Camera>();

            _positionTracker = new CameraPositionTracker(_cameraGameObject.transform, options);
        }
Beispiel #2
0
    public SpOneView(Transform position, Transform camPivotTransform,
                     float rotationSmoothTime, float minRotationX, float maxRotationX, float sphereRadius, float lerpSpeed)
    {
        this.position = position;
        float maxCheckDistance = Mathf.Round((camPivotTransform.position - position.position).magnitude); //0.2f is the plus range

        this.camSateOption = new CameraOptions(rotationSmoothTime, minRotationX, maxRotationX, sphereRadius, lerpSpeed, maxCheckDistance);
    }
        /// <summary>
        /// Constructs a new camera position tracker, using the transform of the camera to manipulate its position.
        /// </summary>
        /// <param name="cameraTransform"></param>
        /// <param name="options"></param>
        public CameraPositionTracker(Transform cameraTransform, ICameraOptions options)
        {
            _options = options;

            _surfaceRadius = (float)options.Radius;
            _radialSpeed   = _surfaceRadius * options.RadialSpeedSensitivity;

            _radius     = InitialDistanceScaleFactor * (float)options.Radius;
            _azimuth    = 0;
            _colatitude = Mathf.PI / 2;

            _cameraTransform = cameraTransform;
        }
Beispiel #4
0
    public SpCameraFollow(Transform targetTransform, Transform cameraRoot, LayerMask collideWith,
                          ref ISpStateView meleeView, ref ISpStateView rangedView, ref IRotateObject objectRotator)
    {
        this.cameraRoot     = cameraRoot;
        this.pivotTransform = cameraRoot.GetChild(0);
        //cameras transform placed as the child of the pivot's position
        this.cameraTransform = pivotTransform.GetChild(0);
        this.targetToFollow  = targetTransform;

        this.meleeView  = meleeView;
        this.rangedView = rangedView;

        this.cameraSettings    = rangedView.BasicView.CameraOption;
        this.cameraSensitivity = new SensitivityCamera(5f, 5f);
        this.cameraFollow      = new CameraFollowObject(150f, targetTransform, cameraRoot);

        this.localStartPos   = this.cameraTransform.localPosition;
        this.currentLocalPos = rangedView.BasicView.OnePosition.localPosition;
        this.toCollideWith   = collideWith;
        this.objectRotator   = objectRotator;
    }
Beispiel #5
0
    public void SetPosition(EMovementID placeMarker)
    {
        if (isZooming)
        {
            return;
        }
        switch (placeMarker)
        {
        case EMovementID.Walking:
            this.cameraSettings  = currentView.BasicView.CameraOption;
            this.currentLocalPos = currentView.BasicView.OnePosition.localPosition;
            break;

        case EMovementID.Running:
            this.cameraSettings  = currentView.RunView.CameraOption;
            this.currentLocalPos = currentView.RunView.OnePosition.localPosition;
            break;

        default:
            break;
        }
    }