fix: remove unnecessory exit transitions for reactive components (#1161)

This commit is contained in:
nekobako 2024-09-23 05:42:31 +09:00 committed by GitHub
parent 5090d45cfe
commit 9dfa0dae23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -295,7 +295,8 @@ namespace nadena.dev.modular_avatar.core.editor
var transitionBuffer = new List<(AnimatorState, List<AnimatorStateTransition>)>();
var entryTransitions = new List<AnimatorTransition>();
transitionBuffer.Add((initialState, new List<AnimatorStateTransition>()));
var initialStateTransitionList = new List<AnimatorStateTransition>();
transitionBuffer.Add((initialState, initialStateTransitionList));
foreach (var group in info.actionGroups.Skip(lastConstant))
{
@ -315,33 +316,30 @@ namespace nadena.dev.modular_avatar.core.editor
var conditions = GetTransitionConditions(asc, group);
foreach (var (st, transitions) in transitionBuffer)
if (!group.Inverted)
{
if (!group.Inverted)
var transition = new AnimatorStateTransition
{
var transition = new AnimatorStateTransition
isExit = true,
hasExitTime = false,
duration = 0,
hasFixedDuration = true,
conditions = (AnimatorCondition[])conditions.Clone()
};
initialStateTransitionList.Add(transition);
}
else
{
foreach (var cond in conditions)
{
initialStateTransitionList.Add(new AnimatorStateTransition
{
isExit = true,
hasExitTime = false,
duration = 0,
hasFixedDuration = true,
conditions = (AnimatorCondition[])conditions.Clone()
};
transitions.Add(transition);
}
else
{
foreach (var cond in conditions)
{
transitions.Add(new AnimatorStateTransition
{
isExit = true,
hasExitTime = false,
duration = 0,
hasFixedDuration = true,
conditions = new[] { InvertCondition(cond) }
});
}
conditions = new[] { InvertCondition(cond) }
});
}
}