public AnimationItem Add(string animationBaseName, bool allowRandomAnimationNumber, bool loop) { //remove from removedItemsForBlending if (blendingTime != 0) { for (int n = 0; n < removedItemsForBlending.Count; n++) { AnimationItem removedItem = removedItemsForBlending[n]; if (removedItem.AnimationBaseName == animationBaseName) { removedItem.animationState.Enable = false; removedItemsForBlending.RemoveAt(n); n--; continue; } } } string animationName = animationBaseName; if (allowRandomAnimationNumber) { int number = GetRandomAnimationNumber(animationBaseName, true); if (number != 1) { animationName += number.ToString(); } } MeshObject.AnimationState animationState = meshObject.GetAnimationState(animationName); if (animationState == null) { return(null); } animationState.Loop = loop; animationState.TimePosition = 0; animationState.Enable = true; AnimationItem item = new AnimationItem(this, animationBaseName, allowRandomAnimationNumber, loop); if (blendingTime != 0) { item.blendingWeightCoefficient = .001f; } else { item.blendingWeightCoefficient = 1; } item.animationState = animationState; activeItems.Add(item); UpdateAnimationStatesWeights(); return(item); }