Esempio n. 1
0
        public override void Write(AssetWriter writer)
        {
            PrefabInstanceLayout layout = writer.Layout.PrefabInstance;

            if (layout.IsModificationFormat)
            {
                WriteObject(writer);

                if (layout.HasRootGameObject && layout.IsRootGameObjectFirst)
                {
                    RootGameObject.Write(writer);
                }

                Modification.Write(writer);
                SourcePrefab.Write(writer);
                if (!layout.IsRootGameObjectFirst)
                {
                    RootGameObject.Write(writer);
                }
                if (layout.HasIsPrefabAsset)
                {
                    writer.Write(IsPrefabAsset);
                }
                if (layout.HasIsExploded)
                {
                    writer.Write(IsExploded);
                }
                writer.AlignStream();
            }
            else
            {
                LastMergeIdentifier.Write(writer);
                if (layout.HasLastTemplateIdentifier)
                {
                    LastTemplateIdentifier.Write(writer);
                }
                Objects.Write(writer);
                Father.Write(writer);
                writer.Write(IsDataTemplate);
                writer.AlignStream();

                base.Write(writer);
            }
        }
Esempio n. 2
0
        public override void Write(AssetWriter writer)
        {
            if (IsModificationsFormat(writer.Version))
            {
                WriteObject(writer);

                bool hasRootGameObject     = IsRootGameObjectRelevant(writer.Flags);
                bool isRootGameObjectFirst = IsRootGameObjectFirst(writer.Version);
                if (hasRootGameObject && isRootGameObjectFirst)
                {
                    RootGameObject.Write(writer);
                }

                Modification.Write(writer);
                SourcePrefab.Write(writer);
                if (hasRootGameObject && !isRootGameObjectFirst)
                {
                    RootGameObject.Write(writer);
                }
                if (IsPrefabAssetRelevant(writer.Version))
                {
                    writer.Write(IsPrefabAsset);
                }
                if (IsExplodedRelevant(writer.Version))
                {
                    writer.Write(IsExploded);
                }
                writer.AlignStream();
            }
            else
            {
                LastMergeIdentifier.Write(writer);
                if (HasLastTemplateIdentifier(writer.Version))
                {
                    LastTemplateIdentifier.Write(writer);
                }
                Objects.Write(writer);
                Father.Write(writer);
                writer.Write(IsDataTemplate);
                writer.AlignStream();

                base.Write(writer);
            }
        }