Working minigame?
This commit is contained in:
@@ -401,6 +401,56 @@ namespace UI.CardSystem.StateMachine
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Color/Tint Animations
|
||||
|
||||
private TweenBase _activeBlinkTween;
|
||||
private Color _originalColor;
|
||||
|
||||
/// <summary>
|
||||
/// Blink an image red repeatedly (for fell-off-conveyor state)
|
||||
/// </summary>
|
||||
public void BlinkRed(UnityEngine.UI.Image image, float blinkSpeed = 0.25f)
|
||||
{
|
||||
if (image == null) return;
|
||||
|
||||
// Stop any existing blink
|
||||
StopBlinking();
|
||||
|
||||
// Store original color
|
||||
_originalColor = image.color;
|
||||
|
||||
// Start blinking red loop
|
||||
BlinkLoop(image, blinkSpeed);
|
||||
}
|
||||
|
||||
private void BlinkLoop(UnityEngine.UI.Image image, float blinkSpeed)
|
||||
{
|
||||
if (image == null) return;
|
||||
|
||||
// Tween to red
|
||||
_activeBlinkTween = Tween.Color(image, Color.red, blinkSpeed, 0f, Tween.EaseInOut,
|
||||
completeCallback: () =>
|
||||
{
|
||||
// Tween back to original
|
||||
_activeBlinkTween = Tween.Color(image, _originalColor, blinkSpeed, 0f, Tween.EaseInOut,
|
||||
completeCallback: () => BlinkLoop(image, blinkSpeed)); // Loop
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop blinking animation and restore original color
|
||||
/// </summary>
|
||||
public void StopBlinking()
|
||||
{
|
||||
if (_activeBlinkTween != null)
|
||||
{
|
||||
_activeBlinkTween.Stop();
|
||||
_activeBlinkTween = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user