Exemplo n.º 1
0
        public void SaveChanges(BinaryWriter writer)
        {
            var spriteSheetsCount = (byte)Math.Min(SpriteSheets.Count, byte.MaxValue);

            writer.Write(spriteSheetsCount);
            for (int i = 0; i < spriteSheetsCount; i++)
            {
                var item = SpriteSheets[i];
                writer.Write(StringEncoding.GetBytes(item));
            }

            var animationsCount = (byte)Math.Min(Animations.Count, byte.MaxValue);

            writer.Write(animationsCount);
            for (int i = 0; i < animationsCount; i++)
            {
                Animations[i].SaveChanges(writer);
            }

            var collisionBoxesCount = (byte)Math.Min(Hitboxes.Count, byte.MaxValue);

            writer.Write(collisionBoxesCount);
            for (int i = 0; i < collisionBoxesCount; i++)
            {
                Hitboxes[i].SaveChanges(writer);
            }
        }
 public void Write(BinaryWriter writer)
 {
     writer.Write(StringEncoding.GetBytes(Name));
     writer.Write((byte)Frames.Count);
     writer.Write((byte)Speed);
     writer.Write((byte)Loop);
     writer.Write((byte)Flags);
     foreach (var entry in Frames)
     {
         entry.Write(writer);
     }
 }