コード例 #1
0
        public void InterpolatePositiveValues()
        {
            var lerp = new LerpByTime(0, 10f, 2f);

            lerp.Eval(1f);
            Assert.AreEqual(5f, lerp.CurrentValue);

            lerp.Eval(1f);
            Assert.AreEqual(10f, lerp.CurrentValue);
        }
コード例 #2
0
        public void InterpolateNegativeValues()
        {
            var lerp = new LerpByTime(-10f, 0f, 2f);

            lerp.Eval(1f);
            Assert.AreEqual(-5f, lerp.CurrentValue);

            lerp.Eval(1f);
            Assert.AreEqual(0f, lerp.CurrentValue);
        }
コード例 #3
0
        public BloodSplatter Setup(float displayTime, Vector2 canvasSize)
        {
            var rect = transform.GetComponent <RectTransform>();

            rect.position = new Vector3(
                Random.Range(0, canvasSize.x),
                Random.Range(0, canvasSize.y),
                0f
                );

            DisplayTime = displayTime;
            lerp        = new LerpByTime(1f, 0f, DisplayTime);
            return(this);
        }
コード例 #4
0
        public void ShouldNotChangeValueIfTimeDidntPassed()
        {
            var lerp = new LerpByTime(0, 10f, 2f);

            Assert.AreEqual(0f, lerp.CurrentValue);
        }