public void PlayAnimation(AnimatedElements type) { UIAnimation anim = GetAnimationByType(type); if (anim != null) { anim.PlayAnimation(); } }
public UIAnimation GetAnimationByType(AnimatedElements type) { UIAnimation animation = null; for (int i = 0; i < Animations.Length; i++) { if (Animations[i].Type == type) { animation = Animations[i].Animation; break; } } if (animation == null) { Debug.LogError("Animation of type " + type + " not found", gameObject); } return(animation); }