private void onObjectedDeselected(ObjectManipulator obj) { ManipulatableObject component = obj.GetComponent <ManipulatableObject>(); ManipulatableObjectEffects component2 = obj.gameObject.GetComponent <ManipulatableObjectEffects>(); Rigidbody component3 = obj.gameObject.GetComponent <Rigidbody>(); if (!obj.WasReparented) { DecorationLayoutData decorationLayoutData = default(DecorationLayoutData); decorationLayoutData.Id = DecorationLayoutData.ID.FromFullPath(GetRelativeGameObjectPath(obj.gameObject)); decorationLayoutData.DefinitionId = component.DefinitionId; decorationLayoutData.Type = component.Type; decorationLayoutData.Position = obj.transform.localPosition; decorationLayoutData.Rotation = obj.transform.localRotation; decorationLayoutData.UniformScale = obj.transform.localScale.x; DecorationLayoutData data = decorationLayoutData; SetCustomPropertiesInDecoration(ref data, obj.GetComponent <PartneredObject>()); if (selectedObjectStartingId == null) { SceneLayoutData.AddDecoration(data); } else { string relativeGameObjectPath = GetRelativeGameObjectPath(component.gameObject); SceneLayoutData.UpdateDecoration(relativeGameObjectPath, data); } } selectedObjectStartingId = null; if ((bool)component2) { component2.ClearObjectManipulator(); } if ((bool)obj) { UnityEngine.Object.Destroy(obj); } if ((bool)component3) { UnityEngine.Object.Destroy(component3); } component.GetComponent <CollidableObject>().EnableTriggers(isTrigger: false); for (int i = 0; i < sceneModifiers.Length; i++) { sceneModifiers[i].AfterObjectDeselected(obj); } this.ObjectDeselected.InvokeSafe(component); }
private DecorationLayoutData UpdateLayoutForManipulatableObject(Transform newParent, ManipulatableObject mo) { string pathId = mo.PathId; if (newParent != mo.transform.parent) { ObjectManipulator.SetUniqueGameObjectName(mo.gameObject, newParent); } DecorationLayoutData decorationLayoutData = default(DecorationLayoutData); decorationLayoutData.Id.Name = mo.gameObject.name; decorationLayoutData.Id.ParentPath = GetRelativeGameObjectPath(newParent.gameObject); decorationLayoutData.DefinitionId = mo.DefinitionId; decorationLayoutData.Type = mo.Type; decorationLayoutData.Position = mo.gameObject.transform.localPosition; decorationLayoutData.Rotation = mo.gameObject.transform.localRotation; decorationLayoutData.UniformScale = mo.gameObject.transform.localScale.x; DecorationLayoutData data = decorationLayoutData; if (data.Id.ParentPath == "") { data.Position = mo.gameObject.transform.position; data.Rotation = mo.gameObject.transform.rotation; data.UniformScale = mo.gameObject.transform.lossyScale.x; data.Id.ParentPath = null; } SetCustomPropertiesInDecoration(ref data, mo.GetComponent <PartneredObject>()); if (SceneLayoutData.ContainsKey(pathId)) { SceneLayoutData.UpdateDecoration(pathId, data); } else { SceneLayoutData.AddDecoration(data); } return(data); }