123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- [Serializable]
- public class AMAnimationKey : AMKey
- {
- public bool setWrapMode(WrapMode wrapMode)
- {
- if (this.wrapMode != wrapMode)
- {
- this.wrapMode = wrapMode;
- return true;
- }
- return false;
- }
- public bool setAmClip(AnimationClip clip)
- {
- if (this.amClip != clip)
- {
- this.amClip = clip;
- return true;
- }
- return false;
- }
- public bool setCrossFade(bool crossfade)
- {
- if (this.crossfade != crossfade)
- {
- this.crossfade = crossfade;
- return true;
- }
- return false;
- }
- public bool setCrossfadeTime(float crossfadeTime)
- {
- if (this.crossfadeTime != crossfadeTime)
- {
- this.crossfadeTime = crossfadeTime;
- return true;
- }
- return false;
- }
- public override AMKey CreateClone()
- {
- AMAnimationKey amanimationKey = ScriptableObject.CreateInstance<AMAnimationKey>();
- amanimationKey.frame = this.frame;
- amanimationKey.wrapMode = this.wrapMode;
- amanimationKey.amClip = this.amClip;
- amanimationKey.crossfade = this.crossfade;
- return amanimationKey;
- }
- public override void CreateFromStringData(string data_text)
- {
- string[] array = data_text.Split(new char[]
- {
- ':'
- });
- if (array.Length == 0 || array[0] != "Animation")
- {
- return;
- }
- NDebug.Assert(this.obj != null, "AMAnimationKey::CreateFromStringData\nobjがnullです");
- this.amClip = null;
- int num = 1;
- this.frame = int.Parse(array[num++]);
- this.wrapMode = (WrapMode)Enum.Parse(typeof(WrapMode), array[num++]);
- bool flag = bool.Parse(array[num++]);
- if (flag)
- {
- Animation[] components = this.obj.GetComponents<Animation>();
- NDebug.Assert(components.Length != 0, "Animation取得失敗");
- string str = array[num++];
- NDebug.Assert(this.amClip != null, "AnimationClip[" + str + "]の取得に失敗しました");
- }
- this.crossfade = bool.Parse(array[num++]);
- }
- public override string ToStringData()
- {
- List<string> list = new List<string>();
- list.Add("Animation");
- list.Add(this.frame.ToString());
- list.Add(this.wrapMode.ToString());
- list.Add((this.amClip != null).ToString());
- string text = list[0];
- for (int i = 1; i < list.Count; i++)
- {
- text = text + ":" + list[i];
- }
- return text;
- }
- public WrapMode wrapMode;
- public GameObject obj;
- public AnimationClip amClip;
- public bool crossfade = true;
- public float crossfadeTime = 0.3f;
- }
|