Ejemplo n.º 1
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Type = (ParticleSystemCollisionType)reader.ReadInt32();
            if (IsReadCollisionMode(reader.Version))
            {
                CollisionMode = (ParticleSystemCollisionMode)reader.ReadInt32();
            }
            if (IsReadColliderForce(reader.Version))
            {
                ColliderForce = reader.ReadSingle();
                MultiplyColliderForceByParticleSize   = reader.ReadBoolean();
                MultiplyColliderForceByParticleSpeed  = reader.ReadBoolean();
                MultiplyColliderForceByCollisionAngle = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }

            Plane0.Read(reader);
            Plane1.Read(reader);
            Plane2.Read(reader);
            Plane3.Read(reader);
            Plane4.Read(reader);
            Plane5.Read(reader);

            if (IsReadDampenSingle(reader.Version))
            {
                float dampenSingle = reader.ReadSingle();
                float bounceSingle = reader.ReadSingle();
                float energyLossOnCollisionSingle = reader.ReadSingle();
                Dampen = new MinMaxCurve(dampenSingle);
                Bounce = new MinMaxCurve(bounceSingle);
                EnergyLossOnCollision = new MinMaxCurve(energyLossOnCollisionSingle);
            }
            else
            {
                Dampen.Read(reader);
                Bounce.Read(reader);
                EnergyLossOnCollision.Read(reader);
            }

            MinKillSpeed = reader.ReadSingle();
            if (IsReadMaxKillSpeed(reader.Version))
            {
                MaxKillSpeed = reader.ReadSingle();
            }
            if (IsReadRadiusScale(reader.Version))
            {
                RadiusScale = reader.ReadSingle();
                CollidesWith.Read(reader);
            }
            if (IsReadMaxCollisionShapes(reader.Version))
            {
                MaxCollisionShapes = reader.ReadInt32();
            }
            if (IsReadQuality(reader.Version))
            {
                Quality   = (ParticleSystemCollisionQuality)reader.ReadInt32();
                VoxelSize = reader.ReadSingle();
            }
            if (IsReadCollisionMessages(reader.Version))
            {
                CollisionMessages = reader.ReadBoolean();
            }
            if (IsReadCollidesWithDynamic(reader.Version))
            {
                CollidesWithDynamic = reader.ReadBoolean();
                InteriorCollisions  = reader.ReadBoolean();
                reader.AlignStream(AlignType.Align4);
            }
        }
Ejemplo n.º 2
0
        public override void Read(AssetStream stream)
        {
            base.Read(stream);

            Type = stream.ReadInt32();
            if (IsReadCollisionMode(stream.Version))
            {
                CollisionMode = stream.ReadInt32();
            }
            if (IsReadColliderForce(stream.Version))
            {
                ColliderForce = stream.ReadSingle();
                MultiplyColliderForceByParticleSize   = stream.ReadBoolean();
                MultiplyColliderForceByParticleSpeed  = stream.ReadBoolean();
                MultiplyColliderForceByCollisionAngle = stream.ReadBoolean();
                stream.AlignStream(AlignType.Align4);
            }

            Plane0.Read(stream);
            Plane1.Read(stream);
            Plane2.Read(stream);
            Plane3.Read(stream);
            Plane4.Read(stream);
            Plane5.Read(stream);

            if (IsReadDampenSingle(stream.Version))
            {
                DampenSingle = stream.ReadSingle();
                BounceSingle = stream.ReadSingle();
                EnergyLossOnCollisionSingle = stream.ReadSingle();
            }
            else
            {
                Dampen.Read(stream);
                Bounce.Read(stream);
                EnergyLossOnCollision.Read(stream);
            }

            MinKillSpeed = stream.ReadSingle();
            if (IsReadMaxKillSpeed(stream.Version))
            {
                MaxKillSpeed = stream.ReadSingle();
            }
            if (IsReadRadiusScale(stream.Version))
            {
                RadiusScale = stream.ReadSingle();
                CollidesWith.Read(stream);
            }
            if (IsReadMaxCollisionShapes(stream.Version))
            {
                MaxCollisionShapes = stream.ReadInt32();
            }
            if (IsReadQuality(stream.Version))
            {
                Quality   = stream.ReadInt32();
                VoxelSize = stream.ReadSingle();
            }
            if (IsReadCollisionMessages(stream.Version))
            {
                CollisionMessages = stream.ReadBoolean();
            }
            if (IsReadCollidesWithDynamic(stream.Version))
            {
                CollidesWithDynamic = stream.ReadBoolean();
                InteriorCollisions  = stream.ReadBoolean();
                stream.AlignStream(AlignType.Align4);
            }
        }