Example #1
0
        public ShipAmmo getAmmo(Ship ship) {
            ShipAmmo ammo = null;

            if(ship is SmallShip) {
                ammo = new ShipAmmo(Properties.Resources.ammo_small_7x9, ship, 30);
            }
            else if(ship is TradeShip) {
                ammo = new ShipAmmo(Properties.Resources.ammo_medium_10x32, ship, 50);
            }
            else if(ship is WarShip) {
                ammo = new ShipAmmo(Properties.Resources.ammo_big_14x56, ship, 100);
            }

            ammo.posX = ship.position.X + ship.width / 2;
            ammo.posY = ship.position.Y;
            return ammo;
        }
 private void damageSubmarine(ShipAmmo ammo) {
     gamePanel.submarine.takeDamage(ammo.damage);
 }