private void TransferOut(double deltaTime, ResourceInfo resourceInfo, ResourcePartMap partInfo)
    {
        var otherParts = resourceInfo.parts.FindAll(rpm => (rpm.direction != TransferDirection.OUT) && (rpm.direction != TransferDirection.LOCKED) && ((rpm.resource.maxAmount - rpm.resource.amount) > 0));
        double available = Math.Min(maxFuelFlow * deltaTime, partInfo.resource.amount);
        double giveToEach = available / otherParts.Count;
        double totalGiven = 0.0;

        foreach (ResourcePartMap otherPartInfo in otherParts)
        {
            if (partInfo.part != otherPartInfo.part)
            {
                double amountGiven = Math.Min(giveToEach, otherPartInfo.resource.maxAmount - otherPartInfo.resource.amount);
                otherPartInfo.resource.amount += amountGiven;

                totalGiven += amountGiven;
            }
        }

        partInfo.resource.amount -= totalGiven;
    }
 public PartPercentFull(ResourcePartMap partInfo, double percentFull)
 {
     this.partInfo = partInfo;
     this.percentFull = percentFull;
 }
    private void TransferIn(double deltaTime, ResourceInfo resourceInfo, ResourcePartMap partInfo)
    {
        var otherParts = resourceInfo.parts.FindAll(rpm => (rpm.direction != TransferDirection.IN) && (rpm.direction != TransferDirection.LOCKED) && (rpm.resource.amount > 0));
        double available = Math.Min(maxFuelFlow * deltaTime, partInfo.resource.maxAmount - partInfo.resource.amount);
        double takeFromEach = available / otherParts.Count;
        double totalTaken = 0.0;

        foreach (ResourcePartMap otherPartInfo in otherParts)
        {
            if (partInfo.part != otherPartInfo.part)
            {
                double amountTaken = Math.Min(takeFromEach, otherPartInfo.resource.amount);
                otherPartInfo.resource.amount -= amountTaken;

                totalTaken += amountTaken;
            }
        }

        partInfo.resource.amount += totalTaken;
    }