1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using UnityEngine;
- public class AMBinaryTranslation : AMBinaryDataBaseObject
- {
- public static bool CheckType(AMTrack track)
- {
- return !(track == null) && track.getTrackType() == AMBinaryTranslation.kTypeName;
- }
- public override void Update(int frame)
- {
- this.trans_.position = this.pos_array[frame];
- }
- public override void Write(BinaryWriter binary)
- {
- List<KeyValuePair<int, int>> list = new List<KeyValuePair<int, int>>();
- Vector3[] array = base.Compression<Vector3>(ref this.pos_array, out list);
- base.Write(binary);
- for (int i = 0; i < this.pos_array.Length; i++)
- {
- binary.Write(this.pos_array[i].x);
- binary.Write(this.pos_array[i].y);
- binary.Write(this.pos_array[i].z);
- }
- }
- public override void Read(BinaryReader binary)
- {
- base.Read(binary);
- this.pos_array = new Vector3[this.total_frame];
- for (int i = 0; i < this.pos_array.Length; i++)
- {
- Vector3 zero = Vector3.zero;
- zero.x = binary.ReadSingle();
- zero.y = binary.ReadSingle();
- zero.z = binary.ReadSingle();
- this.pos_array[i] = zero;
- }
- 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 AMBinaryTranslation.kTypeName;
- }
- }
- public static string kTypeName = "Translation";
- public Transform trans_;
- public Vector3[] pos_array;
- }
|