Ejemplo n.º 1
0
 public void CloneFrom(Fleet fleet)
 {
     this._name = fleet._name;
     this.setID(fleet.getID());
     this.x          = fleet.x;
     this.y          = fleet.y;
     this.playerID   = fleet.playerID;
     this.shipStacks = fleet.shipStacks;
     this.waypoints  = fleet.waypoints;
     this.orbitingID = fleet.orbitingID;
     this.setOrbiting(PlanetDictionary.instance.planetDict[orbitingID]);
     this.damage    = fleet.damage;
     this.starbase  = fleet.starbase;
     this.scrapped  = fleet.scrapped;
     this.cargo     = fleet.cargo;
     this.aggregate = fleet.aggregate;
 }
Ejemplo n.º 2
0
 public void setAggregate(FleetAggregate aggregate)
 {
     this.aggregate = aggregate;
 }
Ejemplo n.º 3
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());
                }
            }
        }
    }