示例#1
0
        public void ToBytes(BinaryWriter writer)
        {
            writer.Write(MinQuantity);
            writer.Write(AddQuantity);
            MinPos.ToBytes(writer);
            AddPos.ToBytes(writer);
            MinVelocity.ToBytes(writer);
            AddVelocity.ToBytes(writer);
            writer.Write(LifeLength);
            writer.Write(GravityEffect);
            writer.Write(MinSize);
            writer.Write(MaxSize);
            writer.Write(Color);
            writer.Write(VertexFlags);
            writer.Write((int)ParticleModel);
            writer.Write(ShouldDieInAir);
            writer.Write(ShouldDieInLiquid);

            writer.Write(OpacityEvolve == null);
            if (OpacityEvolve != null)
            {
                OpacityEvolve.ToBytes(writer);
            }

            writer.Write(RedEvolve == null);
            if (RedEvolve != null)
            {
                RedEvolve.ToBytes(writer);
            }

            writer.Write(GreenEvolve == null);
            if (GreenEvolve != null)
            {
                GreenEvolve.ToBytes(writer);
            }

            writer.Write(BlueEvolve == null);
            if (BlueEvolve != null)
            {
                BlueEvolve.ToBytes(writer);
            }

            writer.Write(SizeEvolve == null);
            if (SizeEvolve != null)
            {
                SizeEvolve.ToBytes(writer);
            }

            writer.Write(SelfPropelled);

            writer.Write(ColorByBlock == null);
            if (ColorByBlock != null)
            {
                writer.Write(ColorByBlock.BlockId);
            }

            writer.Write(ClimateColorMap == null);
            if (ClimateColorMap != null)
            {
                writer.Write(ClimateColorMap);
            }

            writer.Write(SeasonColorMap == null);
            if (SeasonColorMap != null)
            {
                writer.Write(SeasonColorMap);
            }
        }
        public void ToBytes(BinaryWriter writer)
        {
            writer.Write(basePos.X);
            writer.Write(basePos.Y);
            writer.Write(basePos.Z);

            writer.Write(DieInAir);
            writer.Write(DieInLiquid);
            writer.Write(SwimOnLiquid);
            for (int i = 0; i < 4; i++)
            {
                HsvaColor[i].ToBytes(writer);
            }
            GravityEffect.ToBytes(writer);
            LifeLength.ToBytes(writer);
            for (int i = 0; i < 3; i++)
            {
                PosOffset[i].ToBytes(writer);
            }
            Quantity.ToBytes(writer);
            Size.ToBytes(writer);
            for (int i = 0; i < 3; i++)
            {
                Velocity[i].ToBytes(writer);
            }
            writer.Write((byte)ParticleModel);
            writer.Write(VertexFlags);


            writer.Write(OpacityEvolve == null);
            if (OpacityEvolve != null)
            {
                OpacityEvolve.ToBytes(writer);
            }

            writer.Write(RedEvolve == null);
            if (RedEvolve != null)
            {
                RedEvolve.ToBytes(writer);
            }

            writer.Write(GreenEvolve == null);
            if (GreenEvolve != null)
            {
                GreenEvolve.ToBytes(writer);
            }

            writer.Write(BlueEvolve == null);
            if (BlueEvolve != null)
            {
                BlueEvolve.ToBytes(writer);
            }


            SizeEvolve.ToBytes(writer);
            writer.Write(SelfPropelled);
            writer.Write(TerrainCollision);
            writer.Write(ColorByBlock);

            writer.Write(VelocityEvolve != null);
            if (VelocityEvolve != null)
            {
                for (int i = 0; i < 3; i++)
                {
                    VelocityEvolve[i].ToBytes(writer);
                }
            }

            SecondarySpawnInterval.ToBytes(writer);
            if (SecondaryParticles == null)
            {
                writer.Write(0);
            }
            else
            {
                writer.Write(SecondaryParticles.Length);
                for (int i = 0; i < SecondaryParticles.Length; i++)
                {
                    SecondaryParticles[i].ToBytes(writer);
                }
            }


            if (DeathParticles == null)
            {
                writer.Write(0);
            }
            else
            {
                writer.Write(DeathParticles.Length);
                for (int i = 0; i < DeathParticles.Length; i++)
                {
                    DeathParticles[i].ToBytes(writer);
                }
            }

            writer.Write(WindAffectednes);
        }