2017-08-10 07:33:26 -07:00
|
|
|
using System.Collections.Generic;
|
2018-02-04 11:16:30 -06:00
|
|
|
using System.IO;
|
|
|
|
|
using System.Numerics;
|
2017-08-10 07:33:26 -07:00
|
|
|
|
2018-11-22 01:33:17 -05:00
|
|
|
using ACE.Entity.Enum;
|
|
|
|
|
|
2017-08-10 07:33:26 -07:00
|
|
|
namespace ACE.DatLoader.Entity
|
|
|
|
|
{
|
2018-02-04 11:16:30 -06:00
|
|
|
public class MotionData : IUnpackable
|
2017-08-10 07:33:26 -07:00
|
|
|
{
|
2018-02-04 11:16:30 -06:00
|
|
|
public byte Bitfield { get; private set; }
|
2018-11-22 01:33:17 -05:00
|
|
|
public MotionDataFlags Flags { get; private set; }
|
2018-02-04 11:16:30 -06:00
|
|
|
public List<AnimData> Anims { get; } = new List<AnimData>();
|
|
|
|
|
public Vector3 Velocity { get; private set; }
|
|
|
|
|
public Vector3 Omega { get; private set; }
|
2017-08-10 07:33:26 -07:00
|
|
|
|
2018-02-04 11:16:30 -06:00
|
|
|
public void Unpack(BinaryReader reader)
|
2017-08-10 07:33:26 -07:00
|
|
|
{
|
2018-02-04 11:16:30 -06:00
|
|
|
var numAnims = reader.ReadByte();
|
|
|
|
|
Bitfield = reader.ReadByte();
|
2018-11-22 01:33:17 -05:00
|
|
|
Flags = (MotionDataFlags)reader.ReadByte();
|
2018-02-04 11:16:30 -06:00
|
|
|
reader.AlignBoundary();
|
2017-08-10 07:33:26 -07:00
|
|
|
|
2018-02-04 11:16:30 -06:00
|
|
|
Anims.Unpack(reader, numAnims);
|
2017-08-10 07:33:26 -07:00
|
|
|
|
2018-11-22 01:33:17 -05:00
|
|
|
if ((Flags & MotionDataFlags.HasVelocity) != 0)
|
2018-02-04 11:16:30 -06:00
|
|
|
Velocity = reader.ReadVector3();
|
2017-08-10 07:33:26 -07:00
|
|
|
|
2018-11-22 01:33:17 -05:00
|
|
|
if ((Flags & MotionDataFlags.HasOmega) != 0)
|
2018-02-04 11:16:30 -06:00
|
|
|
Omega = reader.ReadVector3();
|
2017-08-10 07:33:26 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|