private void BeginStateDash()
 {
     state = State.Dash;
     dashTimer.Start();
     dashDecayVel = velocity;
     dashDir      = new Vector2(input.lastHorz, 0).normalized;
     DemoCameraController.instance.screenshake.AddTimedShake(dashScreenshake);
     TimeManager.AddTimedDilation(dashTimeSlow);
 }
示例#2
0
        public void Tests()
        {
            ManualTimer manualTimer = new ManualTimer();

            int fireCount = 0;

            // Can't start without an action.
            Assert.Throws <InvalidOperationException>(() => manualTimer.Start());

            // Can't fire without an action.
            Assert.Throws <InvalidOperationException>(() => manualTimer.Fire());

            // Can't set an empty action.
            Assert.Throws <ArgumentNullException>(() => manualTimer.SetAction(null));

            manualTimer.SetAction(() => fireCount++);

            // Can't set action twice.
            Assert.Throws <InvalidOperationException>(() => manualTimer.SetAction(() => fireCount++));

            // Can't fire before starting.
            Assert.Throws <InvalidOperationException>(() => manualTimer.Fire());

            manualTimer.Start();

            Assert.AreEqual(0, fireCount);
            manualTimer.Fire();
            Assert.AreEqual(1, fireCount);

            // Can't fire again before re-starting.
            Assert.Throws <InvalidOperationException>(() => manualTimer.Fire());

            manualTimer.Start();

            Assert.AreEqual(1, fireCount);
            manualTimer.Fire();
            Assert.AreEqual(2, fireCount);
        }
示例#3
0
 public static void StartManualTimer()
 {
     ManualTimer.Start();
 }
 private void BeginStateJump()
 {
     state = State.Jump;
     jumpTimer.Start();
     velocity.y = jumpVel;
 }