Exemplo n.º 1
0
        protected override void Update()
        {
            base.Update();

            if (null != flashTimer)
            {
                flashTimer.OnUpdate(new TimeSlice(Time.deltaTime));

                if (flashTimer.IsFinished)
                {
                    flashTimer          = null;
                    multiRenderer.Color = defaultColor;
                }
                else
                {
                    multiRenderer.Color = flashTimer.IsFlashOn ? flashColor : defaultColor;
                }
            }
        }
Exemplo n.º 2
0
        public void TestFlashTimer()
        {
            var flashTimer = new FlashTimer(2, 1.0f);

            Assert.AreEqual(true, flashTimer.IsFlashOn);

            flashTimer.OnUpdate(new TimeSlice(0.5f));
            Assert.AreEqual(true, flashTimer.IsFlashOn);

            flashTimer.OnUpdate(new TimeSlice(0.5f));
            Assert.AreEqual(false, flashTimer.IsFlashOn);

            flashTimer.OnUpdate(new TimeSlice(0.5f));
            Assert.AreEqual(false, flashTimer.IsFlashOn);

            flashTimer.OnUpdate(new TimeSlice(0.5f));
            Assert.AreEqual(true, flashTimer.IsFlashOn);

            Assert.AreEqual(false, flashTimer.IsFinished);
            flashTimer.OnUpdate(new TimeSlice(2.0f));
            Assert.AreEqual(false, flashTimer.IsFlashOn);
            Assert.AreEqual(true, flashTimer.IsFinished);
        }
Exemplo n.º 3
0
 public void Reset()
 {
     flashTimer = new FlashTimer(flashCount, flashDuration);
 }