Пример #1
0
        public override YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = (YAMLMappingNode)base.ExportYAML(container);

            node.AddSerializedVersion(GetSerializedVersion(container.ExportVersion));
            node.Add(RateOverTimeName, RateOverTime.ExportYAML(container));
            node.Add(RateOverDistanceName, RateOverDistance.ExportYAML(container));
            node.Add(BurstCountName, BurstCount);
            node.Add(BurstsName, Bursts.ExportYAML(container));
            return(node);
        }
Пример #2
0
        public override YAMLNode ExportYAML(IExportContainer container)
        {
#warning TODO: values acording to read version (current 2017.3.0f3)
            YAMLMappingNode node = (YAMLMappingNode)base.ExportYAML(container);
            node.AddSerializedVersion(GetSerializedVersion(container.Version));
            node.Add("rateOverTime", RateOverTime.ExportYAML(container));
            node.Add("rateOverDistance", RateOverDistance.ExportYAML(container));
            node.Add("m_BurstCount", BurstCount);
            node.Add("m_Bursts", Bursts.ExportYAML(container));
            return(node);
        }
Пример #3
0
        public override void Read(AssetStream stream)
        {
            base.Read(stream);

            if (IsReadType(stream.Version))
            {
                Type = stream.ReadInt32();
            }

            RateOverTime.Read(stream);
            if (IsReadRateOverDistance(stream.Version))
            {
                RateOverDistance.Read(stream);
            }

            if (IsReadCnt(stream.Version))
            {
                Cnt0 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16();
                Cnt1 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16();
                Cnt2 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16();
                Cnt3 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16();
            }
            if (IsReadCntMax(stream.Version))
            {
                CntMax0 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16();
                CntMax1 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16();
                CntMax2 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16();
                CntMax3 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16();
            }
            if (IsReadTime(stream.Version))
            {
                Time0 = stream.ReadSingle();
                Time1 = stream.ReadSingle();
                Time2 = stream.ReadSingle();
                Time3 = stream.ReadSingle();
            }

            if (IsIntCount(stream.Version))
            {
                BurstCount = stream.ReadInt32();
            }
            else
            {
                BurstCount = stream.ReadByte();
            }
            stream.AlignStream(AlignType.Align4);

            if (IsReadBursts(stream.Version))
            {
                m_bursts = stream.ReadArray <ParticleSystemEmissionBurst>();
            }
        }
Пример #4
0
        public override YAMLNode ExportYAML(IAssetsExporter exporter)
        {
#warning TODO: values acording to read version (current 2017.3.0f3)
            YAMLMappingNode node = (YAMLMappingNode)base.ExportYAML(exporter);
            node.AddSerializedVersion(GetSerializedVersion(exporter.Version));
            node.Add("rateOverTime", RateOverTime.ExportYAML(exporter));
            node.Add("rateOverDistance", RateOverDistance.ExportYAML(exporter));
            node.Add("m_BurstCount", BurstCount);
            if (IsReadBursts(exporter.Version))
            {
                node.Add("m_Bursts", Bursts.ExportYAML(exporter));
            }
            else if (Config.IsExportTopmostSerializedVersion)
            {
                ParticleSystemEmissionBurst[] bursts = new ParticleSystemEmissionBurst[4];
                bursts[0] = new ParticleSystemEmissionBurst(Time0, Cnt0, IsReadCntMax(exporter.Version) ? CntMax0 : Cnt0);
                bursts[1] = new ParticleSystemEmissionBurst(Time1, Cnt1, IsReadCntMax(exporter.Version) ? CntMax1 : Cnt1);
                bursts[2] = new ParticleSystemEmissionBurst(Time2, Cnt2, IsReadCntMax(exporter.Version) ? CntMax2 : Cnt2);
                bursts[3] = new ParticleSystemEmissionBurst(Time3, Cnt3, IsReadCntMax(exporter.Version) ? CntMax3 : Cnt3);
                node.Add("m_Bursts", bursts.ExportYAML(exporter));
            }
            return(node);
        }
Пример #5
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadType(reader.Version))
            {
                EmissionType type = (EmissionType)reader.ReadInt32();
                if (type == EmissionType.Time)
                {
                    RateOverTime.Read(reader);
                    RateOverDistance = new MinMaxCurve(0.0f);
                }
                else
                {
                    RateOverTime = new MinMaxCurve(0.0f);
                    RateOverDistance.Read(reader);
                }
            }
            else
            {
                RateOverTime.Read(reader);
                RateOverDistance.Read(reader);
            }

            if (IsReadCnt(reader.Version))
            {
                int cnt0 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                int cnt1 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                int cnt2 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                int cnt3 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();

                int cntMax0 = cnt0;
                int cntMax1 = cnt1;
                int cntMax2 = cnt2;
                int cntMax3 = cnt3;
                if (IsReadCntMax(reader.Version))
                {
                    cntMax0 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                    cntMax1 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                    cntMax2 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                    cntMax3 = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadUInt16();
                }

                float time0 = reader.ReadSingle();
                float time1 = reader.ReadSingle();
                float time2 = reader.ReadSingle();
                float time3 = reader.ReadSingle();

                BurstCount = IsIntCount(reader.Version) ? reader.ReadInt32() : reader.ReadByte();
                reader.AlignStream(AlignType.Align4);

                m_bursts = new ParticleSystemEmissionBurst[BurstCount];
                if (BurstCount > 0)
                {
                    m_bursts[0] = new ParticleSystemEmissionBurst(time0, cnt0, cntMax0);
                    if (BurstCount > 1)
                    {
                        m_bursts[1] = new ParticleSystemEmissionBurst(time1, cnt1, cntMax1);
                        if (BurstCount > 2)
                        {
                            m_bursts[2] = new ParticleSystemEmissionBurst(time2, cnt2, cntMax2);
                            if (BurstCount > 3)
                            {
                                m_bursts[3] = new ParticleSystemEmissionBurst(time3, cnt3, cntMax3);
                            }
                        }
                    }
                }
            }
            else
            {
                BurstCount = reader.ReadInt32();
                reader.AlignStream(AlignType.Align4);

                m_bursts = reader.ReadAssetArray <ParticleSystemEmissionBurst>();
            }
        }