Skip to content

Commit

Permalink
Fix animations
Browse files Browse the repository at this point in the history
Not sure what I was thinking here, but I've simplified the logic and it
works better now.
  • Loading branch information
Hotrian committed Jun 23, 2016
1 parent a57a0d7 commit a398a3b
Showing 1 changed file with 40 additions and 69 deletions.
109 changes: 40 additions & 69 deletions Assets/HOTK/HOTK_Overlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -489,98 +489,69 @@ private void HandleAnimateOnGaze(bool hit, ref bool changed)
{
if (AnimateOnGaze == AnimationType.Alpha || AnimateOnGaze == AnimationType.AlphaAndScale)
{
if (Alpha <= Alpha2)
{
if (_alpha < Alpha2)
{
_alpha += AlphaSpeed;
changed = true;
if (_alpha > Alpha2)
_alpha = Alpha2;
}
}
else // Not sure why you'd want it to fade out on gaze, but just in case
if (_alpha < Alpha2)
{
_alpha += AlphaSpeed;
changed = true;
if (_alpha > Alpha2)
{
_alpha -= AlphaSpeed;
changed = true;
if (_alpha < Alpha2)
_alpha = Alpha2;
}
_alpha = Alpha2;
}else if (_alpha > Alpha2)
{
_alpha -= AlphaSpeed;
changed = true;
if (_alpha < Alpha2)
_alpha = Alpha2;
}
}
if (AnimateOnGaze == AnimationType.Scale || AnimateOnGaze == AnimationType.AlphaAndScale)
{
if (Scale <= Scale2)
{
if (_scale < Scale2)
{
_scale += ScaleSpeed;
changed = true;
if (_scale > Scale2)
_scale = Scale2;
}
}
else // Not sure why you'd want it to scale down on gaze, but just in case
if (_scale < Scale2)
{
_scale += ScaleSpeed;
changed = true;
if (_scale > Scale2)
{
_scale -= ScaleSpeed;
changed = true;
if (_scale < Scale2)
_scale = Scale2;
}
_scale = Scale2;
}else if (_scale > Scale2)
{
_scale -= ScaleSpeed;
changed = true;
if (_scale < Scale2)
_scale = Scale2;
}
}
}
else
{
if (AnimateOnGaze == AnimationType.Alpha || AnimateOnGaze == AnimationType.AlphaAndScale)
{
if (Alpha < Alpha2)
{
if (_alpha > Alpha)
{
_alpha -= AlphaSpeed;
changed = true;
if (_alpha < Alpha)
_alpha = Alpha;
}
}
else // Not sure why you'd want it to fade in when you look away from it, but just in case
if (_alpha > Alpha)
{
_alpha -= AlphaSpeed;
changed = true;
if (_alpha < Alpha)
{
_alpha += AlphaSpeed;
changed = true;
if (_alpha > Alpha)
_alpha = Alpha;
}
_alpha = Alpha;
}else if (_alpha < Alpha)
{
_alpha += AlphaSpeed;
changed = true;
if (_alpha > Alpha)
_alpha = Alpha;
}
}

if (AnimateOnGaze == AnimationType.Scale || AnimateOnGaze == AnimationType.AlphaAndScale)
{
if (Scale < Scale2)
{
if (_scale > Scale)
{
_scale -= ScaleSpeed;
changed = true;
if (_scale < Scale)
_scale = Scale;
}
}
else // Not sure why you'd want it to scale up when you look away from it, but just in case
if (_scale > Scale)
{
_scale -= ScaleSpeed;
changed = true;
if (_scale < Scale)
{
_scale += ScaleSpeed;
changed = true;
if (_scale > Scale)
_scale = Scale;
}
_scale = Scale;
}else if (_scale < Scale)
{
_scale += ScaleSpeed;
changed = true;
if (_scale > Scale)
_scale = Scale;
}
}
}
Expand Down

0 comments on commit a398a3b

Please sign in to comment.