private void ModelShotMovedEventHandler(object sender, ShotMovedEventArgs e) { if (!e.Disappeared) { if (!_shots.ContainsKey(e.Shot)) { var shotControl = _gameEngineHelper.ShotControlFactory(e.Shot, Scale); _shots.Add(e.Shot, shotControl); Sprites.Add(shotControl); } else { var shotControl = _shots[e.Shot]; _gameEngineHelper.MoveElementOnCanvas(shotControl, e.Shot.Location.X, e.Shot.Location.Y, Scale); } } else { if (_shots.ContainsKey(e.Shot)) { var shotControl = _shots[e.Shot]; Sprites.Remove(shotControl); _shots.Remove(e.Shot); } } }
void ModelShotMovedEventHandler(object sender, ShotMovedEventArgs e) { if (!e.Disappeared) { if (!_shots.ContainsKey(e.Shot)) { FrameworkElement shotControl = VehicleDefenceHelper.ShotControlFactory(e.Shot, Scale); _shots[e.Shot] = shotControl; _sprites.Add(shotControl); } else { FrameworkElement shotControl = _shots[e.Shot]; VehicleDefenceHelper.MoveElementOnCanvas(shotControl, e.Shot.Location.X * Scale, e.Shot.Location.Y * Scale); } } else { if (_shots.ContainsKey(e.Shot)) { FrameworkElement shotControl = _shots[e.Shot]; _sprites.Remove(shotControl); _shots.Remove(e.Shot); } } }
private void ModelShotMovedEventHandler(object sender, ShotMovedEventArgs e) { if (!e.Disappeared) { if (!_shots.ContainsKey(e.Shot)) { FrameworkElement control = InvadersHelper.ShotControlFactory(e.Shot, Scale); _shots.Add(e.Shot, control); _sprites.Add(control); } else { FrameworkElement control = _shots[e.Shot]; InvadersHelper.MoveElementOnCanvas(control, e.Shot.Location.X * Scale, e.Shot.Location.Y * Scale); } } else { if (_shots.ContainsKey(e.Shot)) { _sprites.Remove(_shots[e.Shot]); _shots.Remove(e.Shot); } } }
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); } }
private void ModelShotMovedEventHandler(object sender, ShotMovedEventArgs e) { if (!e.Dissapeared) { if (e.) { } } }
private void ModelShotMovedEventHandler(object sender, ShotMovedEventArgs e) { if (!e.Disappeared) { if (!_shots.ContainsKey(e.Shot)) { FrameworkElement shotControl = InvadersHelper.ShotControlFactory(e.Shot, Scale); _shots[e.Shot] = shotControl; _sprites.Add(shotControl); } else { InvadersHelper.MoveElementOnCanvas(_shots[e.Shot], e.Shot.Location.X * Scale, e.Shot.Location.Y * Scale); } } else { if (_shots.ContainsKey(e.Shot)) { _sprites.Remove(_shots[e.Shot]); _shots.Remove(e.Shot); } } }
private void _model_ShotMoved(object sender, ShotMovedEventArgs e) { throw new NotImplementedException(); }
private void ShotMovedHandler(object sender, ShotMovedEventArgs e) { Shot shot = e.Shot; if (e.Removed) { AnimatedImage shotControl; if (_shots.ContainsKey(e.Shot)) { shotControl = _shots[e.Shot]; _sprites.Remove(shotControl); _shots.Remove(e.Shot); } } else { AnimatedImage shotControl; if (!e.IsBomb) { List <string> shotImages = new List <string>() { "Assets/shot1.png", "Assets/shot2.png", "Assets/shot3.png", "Assets/shot4.png", }; if (!_shots.ContainsKey(e.Shot)) { shotControl = InvadersHelper.ShotControlFactory(shot, shotImages, Scale) as AnimatedImage; _shots[e.Shot] = shotControl; //InvadersHelper.ResizeElement(shotControl, Shot.ShotSize.Width * Scale, Shot.ShotSize.Height * Scale); _sprites.Add(shotControl); } else { shotControl = _shots[e.Shot]; //InvadersHelper.ResizeElement(shotControl, Shot.ShotSize.Width * Scale, Shot.ShotSize.Height * Scale); InvadersHelper.MoveElementOnCanvas(shotControl, e.Shot.Location.X * Scale, e.Shot.Location.Y * Scale); } } else { List <string> bombImages = new List <string>() { "Assets/bomb1.png", "Assets/bomb2.png", "Assets/bomb3.png", "Assets/bomb4.png", }; if (!_shots.ContainsKey(e.Shot)) { shotControl = InvadersHelper.ShotControlFactory(shot, bombImages, Scale) as AnimatedImage; _shots[e.Shot] = shotControl; _sprites.Add(shotControl); } else { shotControl = _shots[e.Shot]; InvadersHelper.MoveElementOnCanvas(shotControl, e.Shot.Location.X * Scale, e.Shot.Location.Y * Scale); } } } }