示例#1
0
    // Use this for initialization
    void Start()
    {
        distanceTraveled = 0f;
        _totalDistance = 1000f;
        _mediumReferenceSpeed = _totalDistance/mediumCompletionTime;
        _mediumReferenceFuelRate = _referenceStartingFuel/mediumCompletionTime;

        fuel = startingFuel;
        thrustSetting = ThrustSetting.MED;

        fuelRate = - burnCostMap[thrustSetting];
        speed = speedMap[thrustSetting];
    }
            private static List<ThrustSet> GetZeroTorquesSprtZeroTorque(List<ThrustContribution> noTorque, double fuelToThrust)
            {
                Vector3D translation = new Vector3D(0, 0, 0);
                Vector3D torque = new Vector3D(0, 0, 0);
                double fuelUsed = 0d;

                ThrustSetting[] thrusters = new ThrustSetting[noTorque.Count];
                for (int cntr = 0; cntr < noTorque.Count; cntr++)
                {
                    thrusters[cntr] = new ThrustSetting(noTorque[cntr].Thruster, noTorque[cntr].Index, noTorque[cntr].TranslationForce, noTorque[cntr].Torque, noTorque[cntr].TranslationForce.ToUnit(), noTorque[cntr].Torque.ToUnit(), noTorque[cntr].TranslationForce, noTorque[cntr].Torque, 1d);

                    translation += noTorque[cntr].TranslationForce;
                    torque += noTorque[cntr].Torque;
                    fuelUsed += noTorque[cntr].Thruster.ForceAtMax * fuelToThrust;
                }

                List<ThrustSet> retVal = new List<ThrustSet>();
                retVal.Add(new ThrustSet(thrusters, translation, torque, fuelUsed));
                return retVal;
            }
                public ThrustSet(ThrustSetting[] thrusters, Vector3D translation, Vector3D torque, double fuelUsage)
                {
                    this.Thrusters = thrusters;

                    this.Translation = translation;
                    this.Torque = torque;

                    this.TranslationLength = this.Translation.Length;
                    this.TorqueLength = this.Torque.Length;

                    //this.TranslationUnit = this.Translation.ToUnit();
                    //this.TorqueUnit = this.Torque.ToUnit();

                    this.FuelUsage = fuelUsage;
                }