private void ModelShotMovedEventHandler(object sender, ShotMovedEventArgs e)
 {
     if (!e.Disappeared)
     {
         if (!_shots.ContainsKey(e.Shot))
         {
             FrameworkElement shotControl = InvadersHelper.ShotFactory(Shot.ShotSize.Width,
                                                                         Shot.ShotSize.Height,
                                                                         Scale,
                                                                         _timer.Interval);
             InvadersHelper.SetCanvasLocation(shotControl,
                                                 e.Shot.Location.X,
                                                 e.Shot.Location.Y,
                                                 Scale);
             _shots.Add(e.Shot, shotControl);
             _sprites.Add(shotControl);
         }
         else
         {
             FrameworkElement shotControl = _shots[e.Shot];
             InvadersHelper.MoveElementOnCanvas(shotControl,
                                                 e.Shot.Location.X,
                                                 e.Shot.Location.Y,
                                                 Scale);
         }
     }
     else if(_shots.ContainsKey(e.Shot))
     {
         FrameworkElement shotControl = _shots[e.Shot];
         _sprites.Remove(shotControl);
     }
 }
Example #2
0
 private void _model_ShotMoved(object sender, ShotMovedEventArgs e)
 {
     throw new NotImplementedException();
 }