public void SwitchAnimation(string animationName) { if (AnimationNames.Contains(animationName)) { currentAnimation = Array.IndexOf(AnimationNames, animationName); } else { currentAnimation = 0; } }
public void AddAnimation(Animation animation, string animationName) { if (AnimationNames.Contains(animationName)) { throw new Exception(string.Format("Animation by given name \"&1\" already exist.", animationName)); } for (int index = 1; index < animationList.Length; index++) { if (animationList[index] == null) { animationList[index] = animation; AnimationNames[index] = animationName; return; } } throw new IndexOutOfRangeException(string.Format("Animation \"&1\" was out of range of the specified amount.", animationName)); }