コード例 #1
0
        private void TeardownPortalReceiver(OldPortalSettings receiver)
        {
            UnityEngine.Transform container = receiver.transform.parent;
            receiver.transform.SetParent(container.parent);
            Destroy(container.gameObject);

            Destroy(receiver.GetComponent <Portal>());

            OldPortalTeleporter portalTeleporter = receiver.GetComponentInChildren <OldPortalTeleporter>();

            UnityEngine.Transform      volumetricPortal        = receiver.transform.Find("VolumetricPortal");
            OldVolumetricPortalTrigger volumetricPortalTrigger = receiver.GetComponentInChildren <OldVolumetricPortalTrigger>();

            if (portalTeleporter != null)
            {
                Destroy(portalTeleporter.gameObject);
            }
            if (volumetricPortal != null)
            {
                Destroy(volumetricPortal.gameObject);
            }
            if (volumetricPortalTrigger != null)
            {
                Destroy(volumetricPortalTrigger.gameObject);
            }
        }