123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- using System;
- using UnityEngine;
- [Serializable]
- public class AMAnimationAction : AMAction
- {
- public override void execute(int frameRate, float delay, string trackId)
- {
- if (!this.amClip || !this.obj)
- {
- return;
- }
- AMTween.PlayAnimation(this.obj, AMTween.Hash(new object[]
- {
- "trackid",
- trackId,
- "delay",
- base.getWaitTime(frameRate, delay),
- "animation",
- this.amClip.name,
- "wrapmode",
- this.wrapMode,
- "crossfade",
- this.crossfade,
- "fadeLength",
- this.crossfadeTime
- }));
- }
- public override string ToString(int codeLanguage, int frameRate)
- {
- string text = string.Empty;
- if (!this.amClip)
- {
- return null;
- }
- if (codeLanguage == 0)
- {
- string text2 = text;
- text = string.Concat(new object[]
- {
- text2,
- "AMTween.PlayAnimation(obj.gameObject, AMTween.Hash (\"delay\", ",
- base.getWaitTime(frameRate, 0f),
- "f, \"animation\", \"",
- this.amClip.name,
- "\", \"wrapmode\", WrapMode.",
- this.wrapMode.ToString(),
- ",\"crossfade\", ",
- this.crossfade.ToString().ToLower()
- });
- if (this.crossfade)
- {
- text = text + ", \"fadeLength\", " + this.crossfadeTime.ToString() + "f";
- }
- text += "));";
- }
- else
- {
- string text2 = text;
- text = string.Concat(new object[]
- {
- text2,
- "AMTween.PlayAnimation(obj.gameObject, {\"delay\": ",
- base.getWaitTime(frameRate, 0f),
- ", \"animation\": \"",
- this.amClip.name,
- "\", \"wrapmode\": WrapMode.",
- this.wrapMode.ToString(),
- ",\"crossfade\": ",
- this.crossfade.ToString().ToLower()
- });
- if (this.crossfade)
- {
- text = text + ", \"fadeLength\": " + this.crossfadeTime.ToString();
- }
- text += "});";
- }
- return text;
- }
- public int getNumberOfFrames(int frameRate)
- {
- if (!this.amClip)
- {
- return -1;
- }
- if (this.wrapMode != WrapMode.Once)
- {
- return -1;
- }
- return Mathf.CeilToInt(this.amClip.length * (float)frameRate);
- }
- public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
- {
- if (!this.amClip || !this.obj)
- {
- return null;
- }
- return new AnimatorTimeline.JSONAction
- {
- method = "playanimation",
- go = this.obj.gameObject.name,
- delay = base.getWaitTime(frameRate, 0f),
- strings = new string[]
- {
- this.amClip.name
- },
- floats = new float[]
- {
- (float)this.wrapMode,
- this.crossfadeTime
- },
- bools = new bool[]
- {
- this.crossfade
- }
- };
- }
- public AnimationClip amClip;
- public WrapMode wrapMode;
- public GameObject obj;
- public bool crossfade;
- public float crossfadeTime;
- }
|