Example #1
0
        internal static CastleTemplates Parse(BinaryReader reader, MapParseContext context)
        {
            return(ParseAsset(reader, context, version =>
            {
                var propertyKey = AssetPropertyKey.Parse(reader, context);

                var count = reader.ReadUInt32();
                var result = new CastleTemplate[count];

                for (var i = 0; i < count; i++)
                {
                    result[i] = CastleTemplate.Parse(reader, version);
                }

                CastlePerimeter perimeter = null;
                if (version >= 2)
                {
                    perimeter = CastlePerimeter.Parse(reader, version);
                }

                return new CastleTemplates
                {
                    PropertyKey = propertyKey,
                    Templates = result,
                    Perimeter = perimeter
                };
            }));
        }
Example #2
0
        internal static CastleTemplate Parse(BinaryReader reader, ushort version)
        {
            var result = new CastleTemplate
            {
                Name         = reader.ReadUInt16PrefixedAsciiString(),
                TemplateName = reader.ReadUInt16PrefixedAsciiString(),
                Offset       = reader.ReadVector3(),
                Angle        = reader.ReadSingle()
            };

            if (version >= 4)
            {
                result.Priority = reader.ReadUInt32();
                result.Phase    = reader.ReadUInt32();
            }

            return(result);
        }