simplify parameter change

This commit is contained in:
Paul Pacheco 2020-03-24 13:47:10 -05:00
parent aba028e74b
commit c69ae75d6a

View File

@ -221,28 +221,19 @@ ulong NextDirtyBits()
{ {
int newIntValue = animator.GetInteger(par.nameHash); int newIntValue = animator.GetInteger(par.nameHash);
changed = newIntValue != lastIntParameters[i]; changed = newIntValue != lastIntParameters[i];
if (changed) lastIntParameters[i] = newIntValue;
{
lastIntParameters[i] = newIntValue;
}
} }
else if (par.type == AnimatorControllerParameterType.Float) else if (par.type == AnimatorControllerParameterType.Float)
{ {
float newFloatValue = animator.GetFloat(par.nameHash); float newFloatValue = animator.GetFloat(par.nameHash);
changed = Mathf.Abs(newFloatValue - lastFloatParameters[i]) > 0.001f; changed = Mathf.Abs(newFloatValue - lastFloatParameters[i]) > 0.001f;
if (changed) lastFloatParameters[i] = newFloatValue;
{
lastFloatParameters[i] = newFloatValue;
}
} }
else if (par.type == AnimatorControllerParameterType.Bool) else if (par.type == AnimatorControllerParameterType.Bool)
{ {
bool newBoolValue = animator.GetBool(par.nameHash); bool newBoolValue = animator.GetBool(par.nameHash);
changed = newBoolValue != lastBoolParameters[i]; changed = newBoolValue != lastBoolParameters[i];
if (changed) lastBoolParameters[i] = newBoolValue;
{
lastBoolParameters[i] = newBoolValue;
}
} }
if (changed) if (changed)
{ {