Esempio n. 1
0
 public void AddWeapon(WeaponSlot facing, Weapon weapon, int count, bool update = true, bool enabled = true)
 {
     UserControl NewWeapon = null;
     if (weapon == null || weapon.Type == WeaponType.Macrobattery || weapon.Type == WeaponType.Lance)
         NewWeapon = new WeaponTemplate(facing, this, count, weapon, Starship.MacrobatteryModifier);
     else if (weapon.Type == WeaponType.TorpedoTube)
         NewWeapon = new AmmoWeapon(facing, this, count, weapon as TorpedoTubes, enabled);
     else if (weapon.Type == WeaponType.LandingBay)
         NewWeapon = new AmmoWeapon(facing, this, count, weapon as LandingBay, enabled);
     else if (weapon.Type == WeaponType.NovaCannon)
         NewWeapon = new NovaCannonTemplate(facing, this, count, weapon as NovaCannon, enabled);
     if (NewWeapon != null)
     {
         Grid.SetRow(NewWeapon, WeaponRowCount++);//Add the extra row as you place this one
         Grid.SetColumnSpan(NewWeapon, 7);
         Weapons.Children.Add(NewWeapon);
         if (weapon != null && update)
         {
             UpdateSP();
             UpdateUsedSpace();
             UpdateUsedPower();
         }
     }
 }