コード例 #1
0
 /**
  * @return true if this fleet can scan
  */
 public bool canScan()
 {
     if (aggregate.getScanRange() != 0)
     {
         return(true);
     }
     return(false);
 }
コード例 #2
0
    /**
     * Compute the aggregate of this fleet, combining all ships in the fleet
     */
    public void computeAggregate()
    {
        aggregate = new FleetAggregate();
        aggregate.setKillPop(0);
        aggregate.setMinKill(0);
        aggregate.setMass(0);
        aggregate.setShield(0);
        aggregate.setCargoCapacity(0);
        aggregate.setFuelCapacity(0);
        aggregate.setColoniser(false);
        aggregate.setCost(new Cost());
        aggregate.setSpaceDock(-1);

        foreach (ShipStack stack in shipStacks)
        {
            Cost cost = stack.getDesign().getAggregate().getCost().multiply(stack.getQuantity());
            aggregate.setCost(cost.add(aggregate.getCost()));

            aggregate.setKillPop(aggregate.getKillPop() + stack.getDesign().getAggregate().getKillPop() * stack.getQuantity());
            aggregate.setMinKill(aggregate.getMinKill() + stack.getDesign().getAggregate().getMinKill() * stack.getQuantity());

            aggregate.setMass(aggregate.getMass() + stack.getDesign().getAggregate().getMass() * stack.getQuantity());

            aggregate.setArmor(aggregate.getArmor() + stack.getDesign().getAggregate().getArmor() * stack.getQuantity());

            aggregate.setShield(aggregate.getShield() + stack.getDesign().getAggregate().getShield() * stack.getQuantity());

            aggregate.setCargoCapacity(aggregate.getCargoCapacity() + stack.getDesign().getAggregate().getCargoCapacity() * stack.getQuantity());

            aggregate.setFuelCapacity(aggregate.getFuelCapacity() + stack.getDesign().getAggregate().getFuelCapacity() * stack.getQuantity());

            if (stack.getDesign().getAggregate().isColoniser())
            {
                aggregate.setColoniser(true);
            }

            if (stack.getDesign().getAggregate().getSpaceDock() != 0)
            {
                aggregate.setSpaceDock(stack.getDesign().getAggregate().getSpaceDock());
            }

            if (stack.getDesign().getAggregate().getScanRange() != 0)
            {
                if (aggregate.getScanRange() != 0)
                {
                    aggregate.setScanRange(Mathf.Max(aggregate.getScanRange(), stack.getDesign().getAggregate().getScanRange()));
                }
                else
                {
                    aggregate.setScanRange(stack.getDesign().getAggregate().getScanRange());
                }
            }

            if (stack.getDesign().getAggregate().getScanRangePen() != 0)
            {
                if (aggregate.getScanRangePen() != 0)
                {
                    aggregate.setScanRangePen(Mathf.Max(aggregate.getScanRangePen(), stack.getDesign().getAggregate().getScanRangePen()));
                }
                else
                {
                    aggregate.setScanRangePen(stack.getDesign().getAggregate().getScanRangePen());
                }
            }
        }
    }