12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using UnityEngine;
- public class AMBinaryRotation : AMBinaryDataBaseObject
- {
- public static bool CheckType(AMTrack track)
- {
- return !(track == null) && track.getTrackType() == AMBinaryRotation.kTypeName;
- }
- public override void Update(int frame)
- {
- this.trans_.rotation = this.quaternion_array[frame];
- }
- public override void Write(BinaryWriter binary)
- {
- List<KeyValuePair<int, int>> list;
- Quaternion[] array = base.Compression<Quaternion>(ref this.quaternion_array, out list);
- base.Write(binary);
- for (int i = 0; i < this.quaternion_array.Length; i++)
- {
- binary.Write(this.quaternion_array[i].x);
- binary.Write(this.quaternion_array[i].y);
- binary.Write(this.quaternion_array[i].z);
- binary.Write(this.quaternion_array[i].w);
- }
- }
- public override void Read(BinaryReader binary)
- {
- base.Read(binary);
- this.quaternion_array = new Quaternion[this.total_frame];
- for (int i = 0; i < this.quaternion_array.Length; i++)
- {
- Quaternion quaternion = default(Quaternion);
- quaternion.x = binary.ReadSingle();
- quaternion.y = binary.ReadSingle();
- quaternion.z = binary.ReadSingle();
- quaternion.w = binary.ReadSingle();
- this.quaternion_array[i] = quaternion;
- }
- this.trans_ = base.obj.transform;
- }
- public override void SetGameObject(GameObject new_obj)
- {
- base.obj = new_obj;
- this.trans_ = base.obj.transform;
- }
- public override string type_name
- {
- get
- {
- return AMBinaryRotation.kTypeName;
- }
- }
- public static string kTypeName = "Rotation";
- public Transform trans_;
- public Quaternion[] quaternion_array;
- }
|