Exemple #1
0
 public void AddMovement(Movement movement) {
     movement.Progress += d => {
         lock (_sync) {
             if (DateTime.Now - _startTime > Window) {
                 _progress = 0;
                 foreach (var m in Movements) {
                     m.Restart();
                 }
                 _startTime = DateTime.Now;
                 return;
             }
             _progress = d;
             OnStepProgress(_progress);
         }
     };
     movement.Completed += () => {
         lock (_sync) {
             if (Movements.All(m => m.Status == MovementStatus.Completed)) {
                 OnStepCompleted();
                 _progress = 0;
                 foreach (var m in Movements) {
                     m.Restart();
                 }
             }
         }
     };
     movement.AutoRestart = false;
     Movements.Add(movement);
 }
Exemple #2
0
 private static void TrackMovement(Movement m)
 {
     m.Completed += () => Console.WriteLine(m.Name + " -> DONE!!!!");
     m.Restarted += () => Console.WriteLine(m.Name + " -> Restarted");
     m.Progress += d => {
         Console.Write(m.Name + " -> ");
         for (int i = 0; i < d; i++) {
             Console.Write("-");
         }
         Console.WriteLine(">");
     };
 }
 public void SetUp() {
     _camera = new FakeCamera();
     _movement = new MovementForward(_camera.LeftHand, 5);
     _movement.Activate();
 }