Esempio n. 1
0
        internal static CameraAnimation Parse(BinaryReader reader)
        {
            var result = new CameraAnimation();

            result.AnimationType = reader.ReadFourCc(bigEndian: true);
            if (result.AnimationType != "free" && result.AnimationType != "look")
            {
                throw new InvalidDataException();
            }

            result.Name        = reader.ReadUInt16PrefixedAsciiString();
            result.NumFrames   = reader.ReadUInt32();
            result.StartOffset = reader.ReadUInt32();

            switch (result.AnimationType)
            {
            case "free":
                result.FrameData = FreeCameraAnimationFrameData.Parse(reader);
                break;

            case "look":
                result.FrameData = LookAtCameraAnimationFrameData.Parse(reader);
                break;

            default:
                throw new InvalidDataException();
            }

            return(result);
        }
Esempio n. 2
0
        internal static CameraAnimationList Parse(BinaryReader reader, MapParseContext context)
        {
            return(ParseAsset(reader, context, version =>
            {
                var numAnimations = reader.ReadUInt32();
                var animations = new CameraAnimation[numAnimations];

                for (var i = 0; i < numAnimations; i++)
                {
                    animations[i] = CameraAnimation.Parse(reader);
                }

                return new CameraAnimationList
                {
                    Animations = animations
                };
            }));
        }