public void TestValid() { DelegateCurve d = new DelegateCurve((x) => x * 0.5f); float sut = d.Apply(2.0f); Assert.AreEqual(sut, 1.0f); }
public void Set(Vector3 _from, Vector3 _to, float _time, GameMath.AnimateMode _mode, GameMath.Curves _curve) { from = _from; to = _to; speed = 1 / ((_time != 0) ? _time : Mathf.Epsilon); switch (_curve) { case GameMath.Curves.Bounce: curve = GameMath.Bounce; break; case GameMath.Curves.Log: curve = GameMath.Log01; break; case GameMath.Curves.Sigmoid: curve = GameMath.Sigmoid01; break; case GameMath.Curves.SteepSigmoid: curve = GameMath.SteepSigmoid01; break; case GameMath.Curves.ZigZag: curve = GameMath.ZigZag01; break; case GameMath.Curves.Exp: curve = GameMath.ExtremeExp01; break; } switch (_mode) { case GameMath.AnimateMode.position: animation = AnimatePosition; break; case GameMath.AnimateMode.localPosition: animation = AnimateLocalPosition; break; case GameMath.AnimateMode.eulerAngles: animation = AnimateEulerAngles; break; case GameMath.AnimateMode.localEulerAngles: animation = AnimateLocalEulerAngles; break; case GameMath.AnimateMode.rotation: animation = AnimateRotation; break; case GameMath.AnimateMode.localRotation: animation = AnimateLocalRotation; break; case GameMath.AnimateMode.localScale: animation = AnimateLocalScale; break; } StartCoroutine(PlayAnimation()); }
public void TestNull() { DelegateCurve d = new DelegateCurve(null); }