private static void GetWhatToAttachToForNewNos(PositionedObject parentElementRuntime, NamedObjectSave n, Object newObject, out PositionedObject attachTo, out float parentZToSet)
{
attachTo = null;
parentZToSet = 0;
if (n.AttachToCamera &&
// AttachToCamera is not allowed on objects within an Entity
// This can lead to confusing behavior. Technically the NOS itself
// could have AttachToCamera set to true if Glue has messed up somehow
// or if the user has manually edited the .glux. However, even if this
// is the case, we don't want to perform an attachment.
(parentElementRuntime is ElementRuntime == false ||
((ElementRuntime)parentElementRuntime).mAssociatedIElement is EntitySave == false))
{
parentZToSet = 40;
attachTo = SpriteManager.Camera;
}
else if (n.AttachToContainer)
{
if (parentElementRuntime is ElementRuntime == false ||
((ElementRuntime)parentElementRuntime).mAssociatedIElement is ScreenSave == false)
{
attachTo = parentElementRuntime;
}
if (newObject is PositionedObject)
{
// It's already attached to something else in its files
if (((PositionedObject)newObject).Parent != null)
{
attachTo = null;
}
}
}
}