private void configurePartneredObject(DecorationLayoutData decoration, GameObject current) { PartneredObject component = current.GetComponent <PartneredObject>(); if (!(component != null)) { return; } if (decoration.CustomProperties.ContainsKey("guid")) { component.Guid = decoration.CustomProperties["guid"]; guidDictionary[component.Guid] = current; } if (decoration.CustomProperties.ContainsKey("num")) { component.SetNumber(int.Parse(decoration.CustomProperties["num"])); } if (decoration.CustomProperties.ContainsKey("partner")) { component.PartnerGuid = decoration.CustomProperties["partner"]; } if (guidDictionary.ContainsKey(component.PartnerGuid)) { GameObject gameObject = guidDictionary[component.PartnerGuid]; component.Other = gameObject.GetComponent <PartneredObject>(); if (component.Other != null) { component.Other.Other = component; } } }
private void onSplittableObjectChildrenSplit(SplittableObject splittableObject) { ManipulatableObject component = splittableObject.GetComponent <ManipulatableObject>(); CollidableObject component2 = splittableObject.GetComponent <CollidableObject>(); int nextAvailable = numberTracker.GetNextAvailable(); GameObject[] splitList = splittableObject.SplitList; foreach (GameObject gameObject in splitList) { CollidableObject collidableObject = gameObject.AddComponent <CollidableObject>(); collidableObject.CollisionRuleSet = component2.CollisionRuleSet; ManipulatableObject manipulatableObject = gameObject.AddComponent <ManipulatableObject>(); gameObject.AddComponent <ManipulatableObjectEffects>(); if (component != null) { manipulatableObject.DefinitionId = component.DefinitionId; } if (this.ObjectAdded != null) { this.ObjectAdded.InvokeSafe(manipulatableObject); } PartneredObject component3 = gameObject.GetComponent <PartneredObject>(); if (component3 != null) { component3.SetOthers(splittableObject.SplitList); component3.SetNumber(nextAvailable); } UpdateLayoutForManipulatableObject(sceneLayoutContainer, manipulatableObject); manipulatableObject.SetParent(sceneLayoutContainer); manipulatableObject.OnRemoved += onObjectRemoved; manipulatableObject.BeforeParentChanged += onBeforeManipulatableObjectReParented; manipulatableObject.AfterParentChanged += onAfterManipulatableObjectReParented; } component.RemoveObject(deleteChildren: false); splittableObject.ChildrenSplit -= onSplittableObjectChildrenSplit; }