PersistentTrails.OffRailsObject.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
        public void Update()
        {
            activeVessel = FlightGlobals.ActiveVessel;
            mainBody = activeVessel.mainBody;
            if (destroyThis)
                Utilities.debug.debugMessage("Unexpected OffrailsObject Update call from destroyed object");

            //Destruction checks
            if (destructionAllowed)
            {
                if (destroyIfTimewarp)
                {
                    if (TimeWarp.CurrentRate > 1f)
                        if (TimeWarp.WarpMode == TimeWarp.Modes.HIGH)
                        {
                            Utilities.debug.debugMessage("Ghost time warp destruction triggered");
                            destroyThis = true;
                        }
                }
                if (Vector3.Distance(activeVessel.transform.position, gameObject.transform.position) > maxDistanceFromPlayer)
                {
                    Utilities.debug.debugMessage("Ghost distance destruction triggered");
                    destroyThis = true;
                }
                timeOut -= Time.deltaTime;
                if (timeOut < 0f)
                {
                    Utilities.debug.debugMessage("Ghost timeout destruction triggered");
                    destroyThis = true;
                }

                if (destroyThis)
                {
                    performDestruction();
                    return;
                }
            }

            //Reference frame correction
            if (FlightGlobals.ActiveVessel != null)
            {
                referenceFrameCorrection = mainBody.position - lastMainBodyPosition;
                lastMainBodyPosition = mainBody.position;
                if (referenceFrameCorrection.magnitude > 1f)
                {
                    Utilities.debug.debugMessage("Reference Frame shift: " + referenceFrameCorrection);
                    gameObject.transform.position -= referenceFrameCorrection;      // + or -?
                }
            }
        }