Example #1
0
 public void ProbeAlwaysReturnsDefinedValueWhenOnlyOneKeyPointWasDefined()
 {
     var expectedValue = 5f;
     testObj = new LerpCurve(new CurveControlPoint(.5f, expectedValue));
     AssertInputMapsToOutput(0f, expectedValue);
     AssertInputMapsToOutput(.5f, expectedValue);
     AssertInputMapsToOutput(1f, expectedValue);
 }
Example #2
0
 public void ProbeReturnsLinearlyInterpolatedValuesWhenTwoKeyPointsAreDefined()
 {
     testObj = new LerpCurve(new CurveControlPoint(1f, 5f), new CurveControlPoint(3f, 6f));
     AssertInputMapsToOutput(1f, 5f);
     AssertInputMapsToOutput(1.5f, 5.25f);
     AssertInputMapsToOutput(2f, 5.5f);
     AssertInputMapsToOutput(2.5f, 5.75f);
     AssertInputMapsToOutput(3f, 6f);
 }
        private void BuildCamera()
        {
            var curvePoints = new CurveControlPoint[controlPoints.Length];
            for (var i = 0; i < controlPoints.Length; i++)
                curvePoints[i] = new CurveControlPoint(controlPoints[i].distanceToLookTarget, controlPoints[i].cameraAngle);
            var curve = new LerpCurve(curvePoints);

            cam = new AngledLookAtSurfaceCamera(transform, surface.GetSurface(), curve);
            cam.InitializeCamera();
        }
        public void SetUp()
        {
            surfaceOrigin = Vector3.zero;
            surfaceNormal = Vector3.up;
            surfaceUp = Vector3.forward;
            surface = new PlaneSurface(surfaceOrigin, surfaceNormal, surfaceUp);

            curvePoints = new CurveControlPoint[2];
            curvePoints[0] = new CurveControlPoint(1f, 10f);
            curvePoints[1] = new CurveControlPoint(10f, 90f);
            curve = new LerpCurve(curvePoints);

            var testGO = new GameObject();
            testTransform = testGO.transform;
            testObj = new AngledLookAtSurfaceCamera(testTransform, surface, curve);
        }
 public AngledLookAtSurfaceCamera(Transform transform, Surface surface, LerpCurve curve)
     : base(transform, surface)
 {
     this.curve = curve;
 }
Example #6
0
 public void ProbeThrowsExceptionWhenNoKeyPointsAreDefined()
 {
     testObj = new LerpCurve();
     testObj.Probe(.5f);
 }
Example #7
0
 public void ProbeReturnsLastOutputValueWhenInputIsAboveMaximum()
 {
     testObj = new LerpCurve(new CurveControlPoint(10f, 5f), new CurveControlPoint(20f, 10f));
     AssertInputMapsToOutput(25f, 10f);
 }
Example #8
0
 public void ProbeReturnsFirstOutputValueWhenInputIsBelowMinimum()
 {
     testObj = new LerpCurve(new CurveControlPoint(10f, 5f), new CurveControlPoint(20f, 10f));
     AssertInputMapsToOutput(1f, 5f);
 }