Пример #1
0
        public void AnimCurveKey_SetTangentWeights_TangentWeightsGetSet()
        {
            // given:
            var key = new AnimCurveKey();

            key.SetTangentWeightMode(AnimCurveDef.EWeightedMode.eWeightedAll);

            // require:
            Assert.AreEqual(AnimCurveDef.EWeightedMode.eWeightedAll, key.GetTangentWeightMode());
            Assert.AreEqual(AnimCurveDef.sDEFAULT_WEIGHT, key.GetDataFloat(AnimCurveDef.EDataIndex.eRightWeight));
            Assert.AreEqual(AnimCurveDef.sDEFAULT_WEIGHT, key.GetDataFloat(AnimCurveDef.EDataIndex.eNextLeftWeight));

            // when:
            key.SetTangentWeightAndAdjustTangent(AnimCurveDef.EDataIndex.eRightWeight, 0.234f);

            // then:
            Assert.AreEqual(0.234f, key.GetDataFloat(AnimCurveDef.EDataIndex.eRightWeight), 0.0001f);
            Assert.AreEqual(AnimCurveDef.sDEFAULT_WEIGHT, key.GetDataFloat(AnimCurveDef.EDataIndex.eNextLeftWeight));

            // when:
            key.SetTangentWeightAndAdjustTangent(AnimCurveDef.EDataIndex.eNextLeftWeight, 0.567f);

            // then:
            Assert.AreEqual(0.234f, key.GetDataFloat(AnimCurveDef.EDataIndex.eRightWeight), 0.0001f);
            Assert.AreEqual(0.567f, key.GetDataFloat(AnimCurveDef.EDataIndex.eNextLeftWeight), 0.0001f);
        }
Пример #2
0
        public void AnimCurveKey_SetWeightLeftThenRight_WeightIsAll()
        {
            // given:
            var key = new AnimCurveKey();

            // require:
            Assert.AreEqual(AnimCurveDef.EWeightedMode.eWeightedNone, key.GetTangentWeightMode());

            // when:
            key.SetTangentWeightMode(AnimCurveDef.EWeightedMode.eWeightedNextLeft);

            // then:
            Assert.AreEqual(AnimCurveDef.EWeightedMode.eWeightedNextLeft, key.GetTangentWeightMode());

            // when:
            key.SetTangentWeightMode(AnimCurveDef.EWeightedMode.eWeightedRight, AnimCurveDef.EWeightedMode.eWeightedRight);

            // then:
            Assert.AreEqual(AnimCurveDef.EWeightedMode.eWeightedAll, key.GetTangentWeightMode());
        }