Ejemplo n.º 1
0
 public SphereMover(LookAtSurfaceCamera camera, SphereSurface surface, float zoomSpeed, float rotateSpeed)
 {
     this.camera = camera;
     this.surface = surface;
     this.zoomSpeed = zoomSpeed;
     this.rotateSpeed = rotateSpeed;
 }
Ejemplo n.º 2
0
 public PlaneMover(LookAtSurfaceCamera camera, PlaneSurface surface, float zoomSpeed, float panSpeed)
 {
     this.camera = camera;
     this.surface = surface;
     this.zoomSpeed = zoomSpeed;
     this.panSpeed = panSpeed;
 }
 internal override LookAtSurfaceCamera GetCamera()
 {
     if (null == cam)
     {
         cam = new LookAtSurfaceCamera(transform, surface.GetSurface());
         cam.InitializeCamera();
     }
     return cam;
 }
        public void SetUp()
        {
            surfaceOrigin = Vector3.zero;
            surfaceNormal = Vector3.up;
            surfaceUp = Vector3.forward;
            surface = new PlaneSurface(surfaceOrigin, surfaceNormal, surfaceUp);

            var cameraGO = new GameObject();
            transform = cameraGO.transform;
            camera = new LookAtSurfaceCamera(transform, surface);
        }
Ejemplo n.º 5
0
        public void ClampCameraToBounds(LookAtSurfaceCamera camera)
        {
            var maxY = boundsCenter.y + (boundsSize.y * .5f);
            var minY = boundsCenter.y - (boundsSize.y * .5f);
            var distanceToTarget = camera.GetDistanceToTarget();
            if (distanceToTarget >= maxY)
                camera.SetDistanceToTarget(maxY);
            else if (distanceToTarget <= minY)
                camera.SetDistanceToTarget(minY);

            var minX = boundsCenter.x - (boundsSize.x * .5f);
            var lookTarget = camera.GetLookTarget();
            var delta = lookTarget - boundsCenter;
            if (lookTarget.x <= minX)
                camera.TranslateLookTargetTo(new Vector3(minX, lookTarget.y, lookTarget.z));
        }
 private void BuildTestObj()
 {
     testObj = new LookAtSurfaceCamera(testTransform, surface);
     testObj.InitializeCamera();
 }
        public void SetUp()
        {
            surfaceOrigin = Vector3.zero;
            surfaceNormal = Vector3.up;
            surfaceUp = Vector3.forward;
            surface = new PlaneSurface(surfaceOrigin, surfaceNormal, surfaceUp);

            var cameraGO = new GameObject();
            transform = cameraGO.transform;
            camera = new LookAtSurfaceCamera(transform, surface);

            boundsCenter = new Vector3(10f, 5f, 10f);
            boundsSize = new Vector3(5f, 5f, 5f);
            testObj = new AABoxCameraBounds(surface, boundsCenter, boundsSize);
        }
Ejemplo n.º 8
0
        public void SetUp()
        {
            surfaceOrigin = Vector3.zero;
            surfaceNormal = Vector3.up;
            surfaceUp = Vector3.forward;
            surface = new PlaneSurface(surfaceOrigin, surfaceNormal, surfaceUp);

            initialCameraDistance = 100f;
            initialLookTarget = Vector3.zero;
            timeDelta = .25f;
            camera = Substitute.For<LookAtSurfaceCamera>();
            camera.GetDistanceToTarget().Returns(initialCameraDistance);
            camera.GetLookTarget().Returns(initialLookTarget);

            zoomSpeed = 5f;
            panSpeed = 10f;
            testObj = new PlaneMover(camera, surface, zoomSpeed, panSpeed);
        }
Ejemplo n.º 9
0
        public void SetUp()
        {
            surfaceOrigin = Vector3.zero;
            surfaceUp = Vector3.up;
            surfaceRadius = 10f;
            surface = new SphereSurface(surfaceOrigin, surfaceRadius, surfaceUp);

            initialCameraDistance = 100f;
            timeDelta = .25f;

            var go = new GameObject();
            transform = go.transform;
            camera = new LookAtSurfaceCamera(transform, surface);
            camera.InitializeCamera();
            camera.SetDistanceToTarget(initialCameraDistance);

            zoomSpeed = 10f;
            rotateSpeed = Mathf.PI;
            testObj = new SphereMover(camera, surface, zoomSpeed, rotateSpeed);
        }