Ejemplo 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);
        }
Ejemplo n.º 2
0
        internal static LookAtCameraAnimationFrameData Parse(BinaryReader reader)
        {
            var result = new LookAtCameraAnimationFrameData();

            var numCameraFrames = reader.ReadUInt32();

            result.CameraFrames = new LookAtCameraAnimationCameraFrame[numCameraFrames];
            for (var i = 0; i < numCameraFrames; i++)
            {
                result.CameraFrames[i] = LookAtCameraAnimationCameraFrame.Parse(reader);
            }

            var numLookAtFrames = reader.ReadUInt32();

            result.LookAtFrames = new LookAtCameraAnimationLookAtFrame[numLookAtFrames];
            for (var i = 0; i < numLookAtFrames; i++)
            {
                result.LookAtFrames[i] = LookAtCameraAnimationLookAtFrame.Parse(reader);
            }

            return(result);
        }