/// <summary> /// Changes the current ani. but does NOT play it. /// </summary> public void ChangeCurrentAni(string clipName) { if (animations.ContainsKey(clipName)) { currentAni = animations[clipName]; } }
public void ClearCurrentAni() { Stop(); //if streaming ani unload its current frame if (currentAni != null && currentAni.useResourcesLoad) { currentAni.UnloadResourcesCurrentFrame(); } currentAni = null; }
public void LoadAnimation(ZT_SpriteAnimation anim, string customName) { if (animations.ContainsKey(customName)) { return; } ZT_SpriteAnimation newAni = ScriptableObject.CreateInstance <ZT_SpriteAnimation>(); anim.Copy(newAni); newAni.name = customName; newAni.Setup(sp, ZTTimeManager.MainTimer(), this); newAni.SetUseUnityUiImage(useUnityUiImage); animations.Add(customName, newAni); newAni.FrameChanged += FrameChange; }
//copy this animation to another object public void Copy(ZT_SpriteAnimation toAnim) { //Note that useUnityImage needs to be set from the animator, we are not copying that value from another animation! toAnim.speed = speed; toAnim.loop = loop; toAnim.pingPong = pingPong; toAnim.useFlip = useFlip; toAnim.frameGroups = new List <DirectionGroup>(); toAnim.useResourcesLoad = useResourcesLoad; toAnim.playReverse = playReverse; for (int i = 0; i < frameGroups.Count; i++) { toAnim.frameGroups.Add(new DirectionGroup()); frameGroups[i].Copy(toAnim.frameGroups[i]); } }
/** * Loading Animations **/ public void LoadAnimation(ZT_SpriteAnimation anim) { LoadAnimation(anim, anim.name); }