示例#1
0
 /**
  * Assign a slot with a hull component and a quantity
  */
 public void assignSlot(ShipDesignSlot slot, TechHullComponent hullComponent, int quantity)
 {
     if (slot.getHullComponent() == hullComponent)
     {
         slot.setQuantity(slot.getQuantity() + quantity);
     }
     else
     {
         slot.setHullComponent(hullComponent);
         slot.setQuantity(quantity);
     }
     if (slot.getQuantity() > slot.getHullSlot().getCapacity())
     {
         slot.setQuantity(slot.getHullSlot().getCapacity());
     }
 }
示例#2
0
    public void initShipDesign(ShipDesign design)
    {
        TechHull hull = StaticTechStore.getInstance().getHull(design.getHullName());

        design.setHull(hull);
        for (int slotIndex = 0; slotIndex < hull.getSlots().Count; slotIndex++)
        {
            ShipDesignSlot designSlot = design.getSlots()[slotIndex];
            if (designSlot.getHullComponentName() == null)
            {
                break;
            }
            designSlot.setHullSlot(hull.getSlots()[slotIndex]);
            designSlot.setHullComponent(StaticTechStore.getInstance().getHullComponent(designSlot.getHullComponentName()));
        }

        design.getAggregate().setEngine(
            StaticTechStore.getInstance().
            getEngine(
                design.
                getAggregate().
                getEngineName()));
    }