Ejemplo n.º 1
0
        public double GetRequiredFuelMass(double deltaVelocity)
        {
            var totalMass = Mass;

            // TODO: Refactor Enginge.Components to be more user friendly, dont do this shit here
            var massPerCycleSum   = Engine.FuelComponents.Sum(i => i.Mass);
            var componentsByItems = Engine.FuelComponents.ToDictionary(i => i.Item);
            var fuelTank          = new FuelTank(Engine.GetAvailableFuel(CargoBay).Select(i =>
            {
                var portion = componentsByItems[i.Item].Mass / massPerCycleSum;
                return(new FuelComponent(portion, i.Mass));
            }).ToList());

            var dryMass = totalMass - fuelTank.GetAvailableMass();

            return(FuelCalculator.GetConsumedFuel(deltaVelocity, dryMass, fuelTank, Engine.ExhaustVelocity, 1.MeterPerSecond()));
        }