UndockVessel() private method

private UndockVessel ( ) : void
return void
Example #1
0
        public void Detach(AttachType attachType)
        {
            KAS_Shared.DebugLog("Detach(Base) Attach mode is Docked:" + attachMode.Docked + ",Coupled:" + attachMode.Coupled + ",FixedJoint:" + attachMode.FixedJoint + ",StaticJoint:" + attachMode.StaticJoint);
            KAS_Shared.DebugLog("Detach(Base) Attach type is : " + attachType);

            // Docked
            if (attachType == AttachType.Docked)
            {
                if (dockedAttachModule.part.parent == this.part)
                {
                    KAS_Shared.DebugLog("Detach(Base) Undocking " + dockedAttachModule.part.partInfo.title + " from " + dockedAttachModule.vessel.vesselName);
                    dockedAttachModule.UndockVessel();
                }
                if (this.part.parent == dockedAttachModule.part)
                {
                    KAS_Shared.DebugLog("Detach(Base) Undocking " + this.part.partInfo.title + " from " + this.vessel.vesselName);
                    this.UndockVessel();
                }
                if (dockedAttachModule.dockedAttachModule == this)
                {
                    dockedAttachModule.dockedAttachModule = null;
                    dockedAttachModule.dockedPartID       = null;
                    dockedAttachModule.attachMode.Docked  = false;
                }
                this.dockedAttachModule = null;
                this.dockedPartID       = null;
                attachMode.Docked       = false;
            }
            // Coupled
            if (attachType == AttachType.Coupled)
            {
                // Todo
                attachMode.Coupled = false;
            }
            // FixedJoint
            if (attachType == AttachType.FixedJoint)
            {
                KAS_Shared.DebugLog("Detach(Base) Removing fixed joint on " + this.part.partInfo.title);
                if (FixedAttach.fixedJoint)
                {
                    Destroy(FixedAttach.fixedJoint);
                }
                SetCreateJointOnUnpack(false);
                FixedAttach.fixedJoint    = null;
                FixedAttach.connectedPart = null;
                attachMode.FixedJoint     = false;
            }
            // StaticJoint
            if (attachType == AttachType.StaticJoint)
            {
                KAS_Shared.DebugLog("Detach(Base) Removing static rigidbody and fixed joint on " + this.part.partInfo.title);
                if (StaticAttach.fixedJoint)
                {
                    Destroy(StaticAttach.fixedJoint);
                }
                if (StaticAttach.connectedGameObject)
                {
                    Destroy(StaticAttach.connectedGameObject);
                }
                StaticAttach.fixedJoint          = null;
                StaticAttach.connectedGameObject = null;
                attachMode.StaticJoint           = false;
            }
        }
Example #2
0
        public void Detach(AttachType attachType)
        {
            KAS_Shared.DebugLog(string.Format(
                                    "Detach(Base) Attach mode is Docked:{0},Coupled:{1},FixedJoint:{2},StaticJoint:{3}",
                                    attachMode.Docked, attachMode.Coupled, attachMode.FixedJoint, attachMode.StaticJoint));
            KAS_Shared.DebugLog(string.Format("Detach(Base) Attach type is : {0}", attachType));

            // Docked
            if (attachType == AttachType.Docked)
            {
                if (dockedAttachModule.part.parent == this.part)
                {
                    KAS_Shared.DebugLog(string.Format("Detach(Base) Undocking {0} from {1}",
                                                      dockedAttachModule.part.partInfo.title,
                                                      dockedAttachModule.vessel.vesselName));
                    dockedAttachModule.UndockVessel();
                }
                if (this.part.parent == dockedAttachModule.part)
                {
                    KAS_Shared.DebugLog(string.Format(
                                            "Detach(Base) Undocking {0} from {1}", part.partInfo.title, vessel.vesselName));
                    this.UndockVessel();
                }
                if (dockedAttachModule.dockedAttachModule == this)
                {
                    dockedAttachModule.dockedAttachModule = null;
                    dockedAttachModule.dockedPartID       = null;
                    dockedAttachModule.attachMode.Docked  = false;
                }
                dockedAttachModule = null;
                dockedPartID       = null;
                attachMode.Docked  = false;
            }
            // Coupled
            if (attachType == AttachType.Coupled)
            {
                // TODO???
                attachMode.Coupled = false;
            }
            // FixedJoint
            if (attachType == AttachType.FixedJoint)
            {
                KAS_Shared.DebugLog(string.Format(
                                        "Detach(Base) Removing fixed joint on {0}", FixedAttach.srcPart.partInfo.title));
                if (FixedAttach.fixedJoint)
                {
                    Destroy(FixedAttach.fixedJoint);
                }
                SetCreateJointOnUnpack(false);
                FixedAttach.fixedJoint = null;
                FixedAttach.tgtPart    = null;
                attachMode.FixedJoint  = false;
            }
            // StaticJoint
            if (attachType == AttachType.StaticJoint)
            {
                KAS_Shared.DebugLog(string.Format(
                                        "Detach(Base) Removing static rigidbody and fixed joint on {0}", part.partInfo.title));
                if (StaticAttach.fixedJoint)
                {
                    Destroy(StaticAttach.fixedJoint);
                }
                if (StaticAttach.connectedGameObject)
                {
                    Destroy(StaticAttach.connectedGameObject);
                }
                StaticAttach.fixedJoint          = null;
                StaticAttach.connectedGameObject = null;
                attachMode.StaticJoint           = false;
            }
        }