123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using wf;
- [Serializable]
- public class AMRotationKey : AMKey
- {
- public bool setRotation(Vector3 rotation)
- {
- if (this.rotation != Quaternion.Euler(rotation))
- {
- this.rotation = Quaternion.Euler(rotation);
- return true;
- }
- return false;
- }
- public Vector3 getRotation()
- {
- return this.rotation.eulerAngles;
- }
- public bool setRotationQuaternion(Vector4 rotation)
- {
- Quaternion rhs = new Quaternion(rotation.x, rotation.y, rotation.z, rotation.w);
- if (this.rotation != rhs)
- {
- this.rotation = rhs;
- return true;
- }
- return false;
- }
- public Vector4 getRotationQuaternion()
- {
- return new Vector4(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w);
- }
- public override AMKey CreateClone()
- {
- AMRotationKey amrotationKey = ScriptableObject.CreateInstance<AMRotationKey>();
- amrotationKey.frame = this.frame;
- amrotationKey.rotation = this.rotation;
- amrotationKey.easeType = this.easeType;
- amrotationKey.customEase = new List<float>(this.customEase);
- return amrotationKey;
- }
- public override void CreateFromStringData(string data_text)
- {
- string[] array = data_text.Split(new char[]
- {
- ':'
- });
- if (array.Length == 0 || array[0] != "Rotation")
- {
- return;
- }
- int num = 1;
- this.frame = int.Parse(array[num++]);
- this.rotation = Parse.Quaternion(array[num++]);
- this.easeType = int.Parse(array[num++]);
- int num2 = int.Parse(array[num++]);
- this.customEase = new List<float>();
- for (int i = 0; i < num2; i++)
- {
- this.customEase.Add(float.Parse(array[num++]));
- }
- }
- public override string ToStringData()
- {
- List<string> list = new List<string>();
- list.Add("Rotation");
- list.Add(this.frame.ToString());
- list.Add(this.rotation.ToString("G"));
- list.Add(this.easeType.ToString());
- list.Add(this.customEase.Count.ToString());
- foreach (float num in this.customEase)
- {
- list.Add(num.ToString());
- }
- string text = list[0];
- for (int i = 1; i < list.Count; i++)
- {
- text = text + ":" + list[i];
- }
- return text;
- }
- public Quaternion rotation;
- }
|