Exemple #1
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>();
            }
        }
Exemple #2
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>();
            }
        }