[csharp] Match fewer ifs for mixAlpha fix.

f8ea8e99ca
This commit is contained in:
John 2017-04-07 23:11:13 +08:00 committed by GitHub
parent fb6336bf73
commit facae4cb12

View File

@ -413,22 +413,22 @@ namespace Spine {
//from.timelinesRotation.Clear(); //from.timelinesRotation.Clear();
var mixingFrom = from.mixingFrom; var mixingFrom = from.mixingFrom;
float mixProgress = from.mixTime / from.mixDuration;
if (mixingFrom != null && from.mixDuration > 0) { if (mixingFrom != null && from.mixDuration > 0) {
// A mix was interrupted, mix from the closest animation. if (multipleMixing) {
if (!multipleMixing && mixProgress < 0.5f && mixingFrom.animation != AnimationState.EmptyAnimation) { // The interrupted mix will mix out from its current percentage to zero.
current.mixingFrom = mixingFrom; current.mixAlpha *= Math.Min(from.mixTime / from.mixDuration, 1);
mixingFrom.mixingFrom = from; } else {
mixingFrom.mixTime = from.mixDuration - from.mixTime; // A mix was interrupted, mix from the closest animation.
mixingFrom.mixDuration = from.mixDuration; if (from.mixTime / from.mixDuration < 0.5f && mixingFrom.animation != AnimationState.EmptyAnimation) {
from.mixingFrom = null; current.mixingFrom = mixingFrom;
from = mixingFrom; mixingFrom.mixingFrom = from;
} mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
}
// The interrupted mix will mix out from its current percentage to zero.
if (multipleMixing) current.mixAlpha *= Math.Min(mixProgress, 1);
if (!multipleMixing) {
from.mixAlpha = 0; from.mixAlpha = 0;
from.mixTime = 0; from.mixTime = 0;
from.mixDuration = 0; from.mixDuration = 0;