Remove before adding to mix map.

Because it would be *crazy* to want to overwrite an existing map entry, and it's always better to do moar map lookups.
This commit is contained in:
NathanSweet 2013-04-22 11:33:07 +02:00
parent 5b346095cf
commit e98caf2c50

View File

@ -46,7 +46,9 @@ namespace Spine {
public void SetMix (Animation from, Animation to, float duration) {
if (from == null) throw new ArgumentNullException("from cannot be null.");
if (to == null) throw new ArgumentNullException("to cannot be null.");
animationToMixTime.Add(new KeyValuePair<Animation, Animation>(from, to), duration);
KeyValuePair<Animation, Animation> key = new KeyValuePair<Animation, Animation>(from, to);
animationToMixTime.Remove(key);
animationToMixTime.Add(key, duration);
}
public float GetMix (Animation from, Animation to) {