BDB.ModuleBdbLesController.FixedUpdate C# (CSharp) Méthode

FixedUpdate() public méthode

public FixedUpdate ( ) : void
Résultat void
        public void FixedUpdate()
        {
            if (!HighLogic.LoadedSceneIsFlight || vessel.HoldPhysics)
            {
                return;
            }

            if (escapeEngine != null && escapeEngine.EngineIgnited)
            {
                if (Planetarium.GetUniversalTime() - escapeEngineStartTime >= escapeEngineRunTime)
                {
                    escapeEngine.Shutdown();
                }

                // in real life, the LES had a huge chunk of depleted uranium ballast in its nosecone
                // in the game, when we model the LES using a single part the center of mass shifts
                // too far aft as solid fuel is burned, compared to real life. This makes it
                // difficult to maintain stable flight

                // while the escape engine is running, adjust the center of mass offset
                // until 1.2 hits, we also have to adjust the center of pressure offset since CoP
                // is currently incorrectly tied to the final center of mass, rather than the part origin
                var comFactor = (_maxFuel - part.Resources["SolidFuel"].amount) / comMult;
                var copFactor = (_maxFuel - part.Resources["SolidFuel"].amount) / copMult;

                var newComY = _origComOffset.y + (float)comFactor;
                var newCopY = _origCopOffset.y + (float)copFactor;

                part.CoMOffset.Set(_origComOffset.x, newComY, _origComOffset.z);
                //part.CoPOffset.Set(_origCopOffset.x, -newCopY, _origCopOffset.z);

                //Debug.Log(string.Format("CoMOffset updated to {0}", newY.ToString()));

            }

            if (pitchEngine != null && pitchEngine.EngineIgnited)
            {
                if (Planetarium.GetUniversalTime() - pitchEngineStartTime >= pitchEngineRunTime)
                {
                    pitchEngine.Shutdown();
                }
            }

            if (jettisonEngine != null && jettisonEngine.EngineIgnited)
            {
                if (Planetarium.GetUniversalTime() - jettisonEngineStartTime >= jettisonEngineRunTime)
                {
                    jettisonEngine.Shutdown();
                }
            }

            if (_aborted && !_deployed && (Planetarium.GetUniversalTime() >= _canardDeployTime))
            {
                // pop the canards
                DeployCanards();
            }

            if (_aborted && CheckCanAutoJettison())
            {
                DoJettison();
            }
        }