public void TestRecentering(float minValue, float maxValue, bool wrap,
                                    float maxSpeed, float accelTime, float decelTime, bool invert, float axisValue,
                                    bool enabled, float recenteringTime, float expectedValue)
        {
            var axisState = new AxisState(minValue, maxValue, wrap, false, maxSpeed, accelTime, decelTime, null, invert);

            axisState.SetInputAxisProvider(0, new TestAxisProvider(axisValue));
            axisState.Validate();

            var success = axisState.Update(1.0f);

            Assert.IsTrue(success, "Update had no effect");
        }
Example #2
0
    public float TestRecentering(float minValue, float maxValue, bool wrap,
                                 float maxSpeed, float accelTime, float decelTime, bool invert, float axisValue,
                                 bool enabled, float recenteringTime)
    {
        var axisState = new AxisState(minValue, maxValue, false, false, maxSpeed, accelTime, decelTime, null, invert);

        axisState.SetInputAxisProvider(0, new TestAxisProvider(axisValue));
        axisState.Validate();

        var success = axisState.Update(1.0f);

        Assert.IsTrue(success, "Update had no effect");

        var recentering = new AxisState.Recentering(enabled, 0.0f, recenteringTime);

        recentering.DoRecentering(ref axisState, 10.0f, 0.0f);

        return(axisState.Value < Cinemachine.Utility.UnityVectorExtensions.Epsilon ? 0f : axisState.Value);
    }