public static void SetParent(this UTinyEntity self, UTinyEntity.Reference parentRef) { var parent = parentRef.Dereference(self.Registry); Assert.AreNotEqual(self, parent); var transform = self.GetComponent(self.Registry.GetTransformType()); Assert.IsNotNull(transform); // Set new parent transform["parent"] = parentRef; if (UTinyEntity.Reference.None.Id == parentRef.Id) { return; } // Rebind groups if (parent.EntityGroup != self.EntityGroup) { var selfRef = AsReference(self); self.EntityGroup.RemoveEntityReference(selfRef);; parent.EntityGroup.AddEntityReference(selfRef); } }
void ICustomVisit <UTinyEntity.Reference> .CustomVisit(UTinyEntity.Reference value) { VisitReference(value, (int)UTinyTypeId.EntityReference); }
void ICustomVisit <UTinyEntity.Reference> .CustomVisit(UTinyEntity.Reference value) { VisitReference(UTinyBinaryToken.EntityReference, value); }