public void OnShipCollision(object sender, ShipCollisionEventArgs args) { var f = ships.FirstOrDefault(v => v.Position.X == args.Ship.Position .X && v.Position.Y == args.Ship.Position.Y); if (f != null) { if (args.ShipCollidesWithPlayerShip) { DestroyShip(f); OnShipCollidesWithPlayer(new NewShipCollidesWithPlayerShipEventEventArgs(20)); } else { f.PreviousPosition = f.Position; f.Clear(); if (args.Ship.Position.Y <= args.Ship2.Position.Y) { f.Position.Y--; } else { f.Position.Y++; } } } }
public void OnBulletCollision(object sender, ShipCollisionEventArgs args) { if (args.Ship.ShipType == this.Player.Ship.ShipType) { this.Player.Ship.Armor -= 100; this.checkHealth(); } }
public void OnBulletCollision(object sender, ShipCollisionEventArgs args) { IShip ship = args.Ship; if (ship.GetType().BaseType == typeof(EnemyShip)) { if (!ship.IsAlive()) { DestroyShip(ship); OnSendMessageWhenShipDestroyed(new NewDestroyShipEventArgs(100)); } else { DecreaseArmor(ship); } } }
private void OnBulletCollidesWithAShip(ShipCollisionEventArgs args) { bulletCollidesWithAShip?.Invoke(this, args); }
private void OnShipCollision(ShipCollisionEventArgs args) { shipCollidesWithAnotherShip?.Invoke(this, args); }